Re: How to select unique records in PostgreSQL
От | Ron |
---|---|
Тема | Re: How to select unique records in PostgreSQL |
Дата | |
Msg-id | d39ad33d-1a2e-3cd0-c9c3-c9caabdd0698@gmail.com обсуждение исходный текст |
Ответ на | How to select unique records in PostgreSQL (Rama Krishnan <raghuldrag@gmail.com>) |
Ответы |
Re: How to select unique records in PostgreSQL
|
Список | pgsql-general |
Honestly, you do it in PostgreSQL the same way you do it in all the other SQL RDBMSs.
On 11/24/22 06:01, Rama Krishnan wrote:
Hi All,I want to get the unique wallet_id from this table even it was repeated on multiple occasions I should calculate only once as well as if the wallet_id was calculated on previous month it shouldn't be calculate on next monthscreate table student_id(student_wallet_id int,card_id int,created_date date)insert into student_id values ('w1', 'c1', '2022-04-01')insert into student_id values ('w1', 'c2', '2022-04-03')insert into student_id values ('w1', 'c3', '2022-04-04')insert into student_id values ('w1', 'c4', '2022-05-01')insert into student_id values ('w2', 'c1', '2022-05-01')insert into student_id values ('w2', 'c2', '2022-05-04')insert into student_id values ('w3', 'c4', '2022-05-05')insert into student_id values ('w3', 'c6', '2022-06-03)insert into student_id values ('w3', 'c7', '2022-06-05')insert into student_id values ('w3', 'c8', '2022-06-07')expected output:-------------------months count_wallet_id2022-04 12022-05 22022-05 0Regards
A.Rama Krishnan
--
Angular momentum makes the world go 'round.
Angular momentum makes the world go 'round.
В списке pgsql-general по дате отправления: