without count how to query for understating is item duplicate? how to i very fast way to query is item duplicate?
You want to know if an item has more than one row in a table?
SELECT column1, COUNT(*)
FROM table1
WHERE column1 = 'Something'
AND HAVING COUNT(*) > 1
GROUP BY column1
These kinds of queries are always slowish, but with a index on column1 you should be able to speed it up.
@Tray2 can you convert this query Query Builder ?
@ga46 What have you tried so far? Nothing? Then you get nothing...
You might need to offer some additional context. What is an item in this situation, a database record? What's wrong with using a count?
@ga46 then I would follow the advice offered by @tray2 and make appropriate use of an index. After all, what is a duplicate if not something with a count > 1. I don't know how you can count something without counting it.
Please sign in or create an account to participate in this conversation.