Re: "HAVING" problems with query and using 'having' with group by

From: LKBrwn_DBA <member30625_at_dbforums.com>
Date: Mon, 27 Oct 2003 17:17:21 -0500
Message-ID: <3528735.1067293041_at_dbforums.com>


Try this:

select max(note.datetime),

acgr.group_code,

bank.local_acc_no,

bank.short_name,

DECODE
(bank.account_type,

,'Nostro',

1,'Internal',

2,'Safe Keeping',

3,'Draft',

4,'Vostro',

5,'Suspense',

6,'Exchange',

7,'Netting',

8,'Mutual Funds',

'UNKNOWN') AS "Acc Type",

item.gin,

item.value_date,

item.entry_date,

item.ls_type AS "LS Type",

item.currency AS "Currency",

item.amount AS "Amount",

item.sfield_7 AS "SField 7",

item.sfield_8 AS "SField 8",

item.sfield_9 AS "SField 9",

item.bran_code,

note.notetext

FROM grup,

acgr,

bank,

item,

note

WHERE grup.group_code = acgr.group_code

AND acgr.corr_acc_no = bank.corr_acc_no

AND bank.corr_acc_no = item.corr_acc_no

AND item.corr_acc_no = note.corr_acc_no

AND item.gin = note.gin

AND item.flag_2 = 0

AND grup.group_code = 'GMSAZSGREC99'

and bank.account_type in (0)

group by

acgr.group_code,

bank.local_acc_no,

bank.short_name,

DECODE
(bank.account_type,

,'Nostro',

1,'Internal',

2,'Safe Keeping',

3,'Draft',

4,'Vostro',

5,'Suspense',

6,'Exchange',

7,'Netting',

8,'Mutual Funds',

'UNKNOWN') AS "Acc Type",

item.gin,

item.value_date,

item.entry_date,

item.ls_type,

item.currency,

item.amount,

item.sfield_7,

item.sfield_8,

item.sfield_9,

item.bran_code,

note.notetext;

--
Posted via http://dbforums.com
Received on Mon Oct 27 2003 - 23:17:21 CET

Original text of this message