I have a question with regards to an sql query that I am using in my java application. I hope I am posting it at the right place. I have been working on gettign the right query since 2 days. I will be happy if some one can help me with this.
I have two tables whose structure is...
USERS table userID pid (each user is associated with certain number of pids) ------ ----- 55555 111 55555 112 55555 113
Thanks for getting back to me. Apparently, I have already written this query and the result for this query is going to be first record encountered for each pid and simply replace its time by the latest time. So I will get wrong results.
Basically, what it should do is to loop through records for each pid in the customers and display.
SELECT c.pid, MAX(c.time), c.description FROM users u, customers c WHERE u.pid = c.pid AND u.userid = 55555 GROUP BY c.pid, c.description