This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
2
Postgres - How to query table using max()?
Post Flair (click to view more posts with a particular flair)
Post Body
I have a table with name customer which have the following data:
I want to query all client_ids which have the most recent dates as shown below:
I am a newbie to learning SQL. I have thousands of such client IDs. This is what I have tried:
SELECT client_id, id, condition, max(date)
FROM customer GROUP BY client_id, id, condition
ORDER BY client_id DESC
Please help me with getting the above query right as it is not giving me just one row per client_id.
Author
User Disabled
Account Strength
0%
Disabled 4 months ago
Account Age
5 years
Verified Email
Yes
Verified Flair
No
Total Karma
6,531
Link Karma
663
Comment Karma
5,737
Profile updated: 4 days ago
Posts updated: 1 year ago
Subreddit
Post Details
We try to extract some basic information from the post title. This is not
always successful or accurate, please use your best judgement and compare
these values to the post title and body for confirmation.
- Posted
- 4 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/SQL/comment...