MySQL Forums
Forum List  »  Russian

Re: сложная(?) выборка
Posted by: Alexander Dorogikh
Date: February 18, 2010 12:44AM

Придумал и оченб неплохой вариант

если в первых двух случаях можно было не заморачиваться с порядком тегов для которых нужно получить посты, то здесь перед использованием теги нужно отсортировать, но это не такая большая проблема

SELECT DISTINCT Post_id FROM Tag_has_Post t WHERE (SELECT GROUP_CONCAT(DISTINCT Tag_id
ORDER BY Tag_id ASC SEPARATOR '') FROM Tag_has_Post WHERE Post_id=t.Post_id AND Tag_id IN (2,5))='25';

Options: ReplyQuote


Subject
Views
Written By
Posted
11087
February 17, 2010 08:40AM
Re: сложная(?) выборка
3955
February 18, 2010 12:44AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.