
November 28th, 2012, 10:45 AM
|
|
Registered User
|
|
Join Date: Jun 2012
Posts: 17
Time spent in forums: 3 h 48 m 31 sec
Reputation Power: 0
|
|
|
Grouping help for a noob!
Hi
I am trying to group my data so that I only see one row per "account" field and then show the max of the date, the last note and the last note_type records
My query so far is not working - can someone please help? Thank you.
Code:
SELECT
public.slcnote.account,
MAX(public.slcnote.note_date) AS field_1,
public.slcnote.note_note,
public.slcnote.note_type,
public.slcnote.filter
FROM
public.slcnote
WHERE
public.slcnote.company = 1 AND
public.slcnote.filter = 'TSAL'
GROUP BY
public.slcnote.account,
public.slcnote.note_note,
public.slcnote.note_type,
public.slcnote.filter
ORDER BY
public.slcnote.account
|