Hi

I am trying to retrieve a randomly selected line from a table.

The following statements work fine in 2 lines. The 'id' is just any int 
column in the table.
set @random = select top 1 id from Table order by rand();
select * from Table where id=@random;

But if Icombine them into a single statement, it does not work. The inner 
query does not seem to work as expected.

select * from Table where id=(select top 1 id from Table order by rand());

Could anyone please put some light on it?

Thanks
Chandra

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Reply via email to