| From: | Sean Davis <sdavis2(at)mail(dot)nih(dot)gov> |
|---|---|
| To: | pgsql-novice(at)postgresql(dot)org |
| Cc: | kmi(at)st(dot)uz |
| Subject: | Re: Group By problem |
| Date: | 2006-09-26 10:36:39 |
| Message-ID: | 200609260636.39697.sdavis2@mail.nih.gov |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-novice |
On Thursday 21 September 2006 03:06, kmi(at)st(dot)uz wrote:
> I have such problem:
> need to get full record from a table that fits my conditions
>
> SELECT * FROM groups WHERE grouptype=7 GROUP BY groupid HAVING
> max(datecreate)>'2006-09-01'
>
> Postgres tells i should group all fields but this fields have only same
> groupid field value, and i need get full record. This must be a common
> problem i think. How can i solve this?
I can't tell from you SQL statement what you are trying to do. Does this do
what you want?
SELECT * FROM groups WHERE grouptype=7 and datecreate>'2006-09-01'
order by groupid;
If not, then perhaps you need to use a subquery to get the primary key for the
rows that you want and then select those from the master table.
Sean
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Sean Davis | 2006-09-26 10:38:30 | Re: Access to PostgreSQL database from external world |
| Previous Message | Michael Fuhr | 2006-09-26 04:56:21 | Re: Access to PostgreSQL database from external world |