I’m currently working with this MySQL statement:
SELECT * FROM jobs GROUP BY jobType, address1;
I need to be able to add another condition to this query. GROUP BY only combines duplicates, but I also need to combine all rows that have a jobType of ‘1’ or a jobType of ‘2’. All other jobTypes will be grouped normally.
For example, my table looks something like this:
jobType | address1
1 | 123 State st
2 | 123 State st
3 | 415 5th Ave
1 | 123 State st
1 | 24 3rd Ave
1 | 123 State st
3 | 555 Mission st
4 | 123 State st
I want to combine rows 1 and 2, even though their jobType is different. Again, any rows with a jobType other than either 1 or 2 would be grouped normally.
1 Answer