King_kamikaze
Registered User.
- Local time
- Today, 20:26
- Joined
- Jan 13, 2005
- Messages
- 48
Hello all,
I am having trouble creating a query, here is the query i am having issues with
Now the query above works fine with out the "a.prod_code" as a column, as you can see i want the maximum value in b.app that relates to a.app_num, what i need to then do is select the b.prod_code the relates to the Max(b.app).
Sorry if this is not clear, please let me know and i will try to elaborate.
Many thanks
Tim
I am having trouble creating a query, here is the query i am having issues with
Code:
SELECT a.app_num, Max(b.app) AS Highest, a.prod_code
FROM table1 AS a LEFT JOIN table2 AS b ON a.prod_code = b.GSN
GROUP BY a.app_num, a.prod_code;
Now the query above works fine with out the "a.prod_code" as a column, as you can see i want the maximum value in b.app that relates to a.app_num, what i need to then do is select the b.prod_code the relates to the Max(b.app).
Sorry if this is not clear, please let me know and i will try to elaborate.
Many thanks
Tim