Note: I am a little new to SQL Server, so this should be an easy question, and I apologize for mistakes in formatting this question.
This is SQL Server 2008 R2.
I have two tables.
Table 1:
DATA
has keyID
and columnsPROD_ID, COLLECT_TS
Table 2:
PRODUCT
has keyPROD_ID
and columnPROD_NAME
I want my query to list every PROD_NAME
by the latest COLLECT_TS
Here is what I have thus far:
SELECT MAX(COLLECT_TS), PROD_ID
FROM dbo.SG_DATA
GROUP by PROD_ID
This successfully returns all the latest COLLECT_TS
with a PROD_ID
, but the PROD_ID
is just a number and doesn't mean anything to the user.
Thanks in advance for your answers.