I need to request the maximum identifier from two tables, and I need to take the identifier of which is larger. I am using sqlserver.
Inquiries
SELECT MAX(a.ID)
FROM tableA a
SELECT MAX(b.ID)
FROM tableB b
If the tableAmaximum ID is 20 and the tableBmaximum ID is 30, then UNIONonly 30 should return both table queries.
Is it possible to combine both requests into one request in order to return the maximum ID?
source
share