I´m wondering how to create a query that returns SERIALID, QTY, but only for the last INVOICEDATE.
To combine information from two tables I use UNION.
SELECT ab.SERIALID, ab.QTY, ab.INVOICEDATE
FROM (SELECT a.INVOICEDATE, a.SERIALID, a.QTY
FROM SALESTRANS a
UNION
SELECT b.INVOICEDATE, b.SERIALID, b.QTY
FROM SERVICETRANS b
) ab
I have two tables combined with UNION and my table looks:
I would like to make a query that returns SERIALID, QTY, but only for the last INVOICEDDATE.
The result I would like to get:
Thanks in advance!