I have a table where i keep all the bids details. I want to list only one bid for a user.
Table Structure
------------------------------
auto_id - auto increment
userid - registered user int id
email - if the bidder is not a registered user, he/she can bid by supplying email
If i use this query, it will list only one bid for each registered member but at the same time only one bid for all non-registered members' bids.
Code: Select all
SELECT auto_id, userid, email FROM bids GROUP BY useridOR
GROUP BY on userid if userid>0 and list all the other records where userid=0
I am using MySQL 4.1.