Table 1: id, number
Table 2: id, number
Here's my query:
SELECT COALESCE(table1.number, MAX(table2.number))
FROM table1, table2
WHERE table.id = table2.id
GROUP BY table1.number, table2.number
Not all table1.number have values. In that case, I want the max of table2.number.
There are 0 to many table2 rows per table1 row in the database.
I'm getting back all the rows, including those that aren't MAX(table2.number)
Do I need to specify somewhere that I want MAX(table2.number) on table2.id = table1.id?
Table 2: id, number
Here's my query:
SELECT COALESCE(table1.number, MAX(table2.number))
FROM table1, table2
WHERE table.id = table2.id
GROUP BY table1.number, table2.number
Not all table1.number have values. In that case, I want the max of table2.number.
There are 0 to many table2 rows per table1 row in the database.
I'm getting back all the rows, including those that aren't MAX(table2.number)
Do I need to specify somewhere that I want MAX(table2.number) on table2.id = table1.id?