Created
October 20, 2011 19:13
-
-
Save shofetim/1302018 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT COUNT(*) AS `count` | |
| 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%')) | |
| GROUP BY `Form`.`id` ; | |
| //Result | |
| +-------+ | |
| | count | | |
| +-------+ | |
| | 1 | | |
| | 2 | | |
| | 2 | | |
| +-------+ | |
| //Desired Result | |
| +-------+ | |
| | count | | |
| +-------+ | |
| | 3 | | |
| +-------+ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment