Skip to content

Instantly share code, notes, and snippets.

@dead23angel
Last active August 29, 2015 13:56
Show Gist options
  • Save dead23angel/9029382 to your computer and use it in GitHub Desktop.
Save dead23angel/9029382 to your computer and use it in GitHub Desktop.
SELECT
news.title,
news.slug,
news.datetime,
news.content,
news.category_id,
news.tags
FROM
public.tagging_tag,
public.tagging_taggeditem,
public.news
WHERE
tagging_tag.id = tagging_taggeditem.tag_id AND
tagging_taggeditem.object_id = news.id AND
tagging_tag.name = 'тест' AND --ищем по тегу тест
tagging_taggeditem.content_type_id = 9; --равно 9 ибо это ид таблицы новостей
Суммарное время выполнения запроса: 11 ms.
2 строки получено.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment