Hello! I have a table with 3 columns: 1.Invoice Number 2. Rating and 3.Checking
Checking is 0 or 1 depending on Rating.
I wrote the following query.
select a.Invoicenumber,a.rating, (case when a.Rating<=3 then (case when rand() <=0.05 then 1 else 0 end) when a.Rating>3 and a.Rating<=4 then (case when rand() <= 0.1 then 1 else 0 end) when a.Rating>4 and a.Rating<=5 then (case when rand()<=0.2 then 1 else 0 end) else 1 end) as checking from #temp2
My question is every time i run it rand() takes only one value? How could i do it so rand() is different for each row of my table?