|
Posted by Ridge Burner on 04/11/06 00:54
I currently have a DB with several rows of submitted items in it. There are
several items per user, but I am only interested in getting the first 3 for
each user. The script from the previous coder calls each query seperately,
but this is hard to maintain and I was hoping I could put this all in a
single SQL statement instead.
Right now the script queries for 3 rows from user #1 and stores in array,
then calls for next 3 from user #2 and stores in array etc etc.
I'm looking for a SQL statement like so:
$sql = "SELECT first 3 items for each UNIQUE user ORDER BY date_added ASC";
(yes, sql is wrong, its just an example to show what I want!)
I really hope this is possible, it would really cut down a lot of redundant
code we have now. I did look at MySQL site and PHP site, but could not find
anything that looked like it would do the trick.
Thanks in advance!
Navigation:
[Reply to this message]
|