ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From macdoug1 <macdo...@swbell.net>
Subject Can't figure out the SQL syntax for this.Does anyone know?
Date Wed, 25 Apr 2007 15:52:18 GMT

Here's my situation, I've got a table that could potentially have millions of
records in it and I need to select based on a cellid the other columns in
the table. But here's where it gets ugly, I need to select these records
randomly and be able to only select a certain number of random records,
based on what the user has passed in to me. So say there are 1000 records
for that cellid I need to be able to select randomly in oracle a number of
records that the user has requested (say 100). I've got this working where I
can select the information I want randomly but I can only figure out how to
get one record. Anyone have any ideas?

Here's what I have so far:  SELECT card_number,promo_id FROM
( SELECT card_number, promo_id FROM cell_card
  where cell_id = 246 ORDER BY dbms_random.value )
WHERE rownum = 1;

this returns only one record.
-- 
View this message in context: http://www.nabble.com/Can%27t-figure-out-the-SQL-syntax-for-this.Does-anyone-know--tf3646279.html#a10183669
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


Mime
View raw message