Skip to content

Instantly share code, notes, and snippets.

@shofetim
Created October 20, 2011 20:46
Show Gist options
  • Select an option

  • Save shofetim/1302335 to your computer and use it in GitHub Desktop.

Select an option

Save shofetim/1302335 to your computer and use it in GitHub Desktop.
SELECT count(distinct(`Form`.`id`)) as numberof
FROM `forms` AS Form
LEFT JOIN forms_tags AS `FormsTags` ON (`Form`.`id` = `FormsTags`.`form_id`)
LEFT JOIN tags AS `Tag` ON (`FormsTags`.`tag_id` = `Tag`.`id`)
LEFT JOIN `statuses` AS `Status` ON (`Form`.`status_id` = `Status`.`id`)
LEFT JOIN `form_types` AS `FormType` ON (`Form`.`form_type_id` = `FormType`.`id`)
LEFT JOIN `summaries` AS `Summary` ON (`Form`.`summary_id` = `Summary`.`id`)
WHERE ((`Form`.`title` LIKE '%titl%') OR (`Tag`.`title` LIKE '%titl%')) ;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment