L
Leo Rod
good afternoon All,
I would like to know the SQL to select only the "top" record of a query
sorted by date/number or operation of numbers e.g. max of date, min of
stock, etc so I only retrieve the first and most important value instead of
a set of several values.
here below an EG from a query I use every day:
SELECT pordtl.pdtiid, pordtl.pdtvds, pordtl.pdtluc, pordtl.pdtvum,
pordtl.pdtwhs, pordtl.pdtode, pordtl.pdtvdr
FROM beth.pordtl pordtl
GROUP BY pordtl.pdtiid, pordtl.pdtvds, pordtl.pdtluc, pordtl.pdtvum,
pordtl.pdtwhs, pordtl.pdtode, pordtl.pdtvdr
HAVING (pordtl.pdtiid Is Not Null)
ORDER BY pordtl.pdtode DESC
If I only need the top, or bottom, row of the order, what is the SQL
operation that narrows the query?
All information will be gratly appreciatted!
Thanks
Leo.
I would like to know the SQL to select only the "top" record of a query
sorted by date/number or operation of numbers e.g. max of date, min of
stock, etc so I only retrieve the first and most important value instead of
a set of several values.
here below an EG from a query I use every day:
SELECT pordtl.pdtiid, pordtl.pdtvds, pordtl.pdtluc, pordtl.pdtvum,
pordtl.pdtwhs, pordtl.pdtode, pordtl.pdtvdr
FROM beth.pordtl pordtl
GROUP BY pordtl.pdtiid, pordtl.pdtvds, pordtl.pdtluc, pordtl.pdtvum,
pordtl.pdtwhs, pordtl.pdtode, pordtl.pdtvdr
HAVING (pordtl.pdtiid Is Not Null)
ORDER BY pordtl.pdtode DESC
If I only need the top, or bottom, row of the order, what is the SQL
operation that narrows the query?
All information will be gratly appreciatted!
Thanks
Leo.