Mysql query return duplicate entries with in and find_int_set?

Rather than use an IN clause, you need to join on the id values. IE.

Rather than use an IN clause, you need to join on the id values. IE: SELECT t. Stuff FROM YOUR_TABLE t JOIN (SELECT 6176 AS tid, UNION ALL SELECT 6176 UNION ALL SELECT 6176 UNION ALL SELECT 3091) x ON x.

Tid = t. Id ORDER BY FIND_IN_SET(t. Id, '6176, 6176, 6176, 3091') LIMIT 25 You need to split that comma separated list into a table with a single column - see: http://forge.mysql.com/tools/tool.php?id=4.

It sounds counter-intuitive, but the join ensures that rows that match are returned in the resultset. Usually people want the reverse - they want to get rid of duplicates, and need to use IN or EXISTS to do so rather than using GROUP BY or DISTINCT... – OMG Ponies Aug 29 '10 at 22:17 Thanks man, you got me going with the union and the possibility to create a temporarily table. The code I am using now is code $documents = explode(",",$data); $queryData = ""; for($i = 0; $i = "UNION ALL SELECT {$documents$i} "; } $query = " SELECT t.

Title as title, t. Creator as creator, t. Id as id, t.

CreationDate as createionDate, t. LastEdit as lastEdit, t. LastEditedBy as lastEditedBy FROM document_data t JOIN ( SELECT 0 AS id $queryData )x ON x.Id = t.

Id ";/code – Jorik Aug 29 '10 at 23:09 @Jorik: Cool, because you have duplicates you need to use UNION ALL because UNION would remove the duplicates. – OMG Ponies Aug 29 '10 at 23:13 Yea I read that on other question indeed, thanks again! Actually learned a few neat MySQL tricks too.

I clicked the check image under your answer, does that automatically set the question to answered? I'm kinda new here, so I don't really know how it all works here – Jorik Aug 29 '10 at 23:19 @Jorik: Yep, just need to click the checkmark under the number on the left to mark an answer for the question. You won't be able to upvote (by clicking the arrow on the top of the number) until you have 15 reputation; can't downvote until 100.

– OMG Ponies Aug 29 '10 at 23:44.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions