Is there a way to only group by certain rows when a specific value is set?
i.e. I have the following table:
USERNO | FIRSTNAME | NAME | CUSTOMER | YEAR
1 | Jon | Snow | 0 | 2014
2 | Williams | Spear | 1 | 2015
1 | John | Snow | 1 | 2015
3 | Sam | Wells | 0 | 2014
3 | Sam | Wells | 0 | 2013
When CUSTOMER is 1, it should group by USERNO. So I want the following result:
USERNO | FIRSTNAME | NAME | CUSTOMER | YEAR
1 | Jon | Snow | 1 | 2014
2 | Williams | Spear | 1 | 2015
3 | Sam | Wells | 0 | 2014
3 | Sam | Wells | 0 | 2013
Is this possible?
Thanks in advance!
Aucun commentaire:
Enregistrer un commentaire