I have business table and there is also a sf_tagging table to save the tags for that business. The query used for selecting the businesses is given below. In this sf_tagging table is left joined with business table. Since there will be different results for different tags of same business, I have grouped the results by business id(which is same as taggable_id in sf_tagging table). But the problem is that from amongst the businesses which have no tags, only one is selected since the taggable_id for all of them is null. Is there any way in which the query can be modified so that the results will not be grouped for cases in which there are no tags, and grouped in all other cases?
sf_tagging and sf_tag tables are generated when installing the sfpropelactsastaggablebehaviour plugin of symfony php framework.In sf_tagging table taggable_id field the business id will be stored and the tags will be stored in sf_tag table and its id stored in sf_tagging table. QUERY: select business.* ,sf_tagging.TAGGABLE_ID from business left join sf_tagging on (business.ID=sf_tagging.TAGGABLE_ID) left join sf_tag on (sf_tagging.TAG_ID=sf_tag.ID) where (business.NAME LIKE '%testing%' or sf_tag.TRIPLE_KEY= 'testing') group by sf_tagging.TAGGABLE_ID --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~----------~----~----~----~------~----~------~--~---
