I am struggling to create an SQL query:
I have a table, with product ID's and an update number
ID,freq
46,2
75,1
57,5
75,4
75,4
Clearly, in this example, product ID 75 is the most updated. however if i do:
i get 57 as the winner. Why? becasue it has 5, and sql isnt adding up the 75's to get the true winner, at 9 views.
can anyone point me towards the right type of query?
I have a table, with product ID's and an update number
ID,freq
46,2
75,1
57,5
75,4
75,4
Clearly, in this example, product ID 75 is the most updated. however if i do:
Code:
SELECT DISTINCT ID, freq FROM table ORDER BY freq DESC
can anyone point me towards the right type of query?
Comment