I’m trying to create a query that will group results BY where the grouped by field is not empty.
My query goes like this:
the thing is that all the rows where the created_by_alias is empty are grouped into one, which is not good. I need to group only where the value is different than ”.
I cannot change the field to be NULL by default because of some reasons (the website is on joomla and in order to do this i’ll have to change the core).
SELECT c.created_by_alias, c.introtext,c.id,c.publish_up,c.publish_down
FROM jos_content as c
GROUP BY c.created_by_alias
Is such thing possible?
Thanks for your time and knowledge 🙂
example :
| name | groupMe |
---------------------------------------
| aaa | XX |
---------------------------------------
| aaa | XX |
---------------------------------------
| ccc | |
---------------------------------------
| ddd | |
---------------------------------------
I would like to receive such results:
---------------------------------------
| aaa | XX |
---------------------------------------
| ccc | |
---------------------------------------
| ddd | |
---------------------------------------
I hope
Another way would be: