How do I get just one result when running a sql query?
SELECT user_ids FROM `items开发者_C百科`
When I run that query, if a user has multiple items listed, I get the user_id listed that many times, but what I really want is just ONE user_id for each so it basically represents all the user_ids who have >1 entry in the items table (and what I really want is the corresponding email)
If I understand correctly you want to use distinct
SELECT DISTINCT user_ids FROM items
Select Distinct user_ids FROM items
From your context of > 1 entry (ie: more than 1 entry), you'll need a group by, not just distinct... distinct will include everyone, even if they ONLY have ONE entry
select User_IDs
from items
group by User_IDs
having count(*) > 1
精彩评论