I have a query using Firebird where it randomly picks one record; however, I am looping this query and therefore the same record often shows up more than one time. How can I avoid this?
Should I collect the records somewhere and then go for something "and NOT" ?
for x := 1 to (strtoint(antalskadadespelare.caption)) do begin (will loop between 1-10 times)
s := Random(3);
if s = 0 then
Lag.sql.add('select First 1 * from Lag where intspelare = 0 and antalvarv > 0 and MV < 2 and NOT Division = ''AHL'' order by rand()');
if not Lag.IsEmpty then
intklubb.caption := Lag['Klubb'];
intrykte.caption := Lag['Rykte'];
intland.caption := Lag['Nation'];
intekonomi.caption := Lag['Ekonomi'];
intposition.caption := 'M'
else if s = 1 then