Demaestro

msg:4134845 | 6:51 pm on May 18, 2010 (gmt 0) |
try this: Select * from table where grp="3" order by vt desc limit 3 For more than one where clause it would be like this. *****Execute as 1 statement******* Select * from table where grp="1" order by vt desc limit 3 UNION Select * from table where grp="2" order by vt desc limit 3 ************END************ Play around with those and see if you are getting the desired results. Post back if you need.
|
Demaestro

msg:4134848 | 6:57 pm on May 18, 2010 (gmt 0) |
FYI: You can do more than 2 unions Just make sure you have a UNION between each query. Select * from table where grp="1" order by vt desc limit 3 UNION Select * from table where grp="2" order by vt desc limit 3 UNION Select * from table where grp="3" order by vt desc limit 3 This is the only way to limit each grp to 3 rows though and have it returned in 1 query.
|
jaruba

msg:4134855 | 7:06 pm on May 18, 2010 (gmt 0) |
Thank you for the quick reply, this should be exactly what I needed.
|
|