Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> I need some help with this query
I have this query:
select store_id, sum(amount + freight) Total from REPORT_TRANSACTION_VIEW
where TRANSACTION_DATE >= 936158400 and TRANSACTION_DATE <= 938664000
and transaction_type != '3'
and STORE_ID =
(select store_id from STORE SS where SS.KEY_STORE_SEQID =
(select V.KEY_STORE_SEQID from REPORT_STORES_VIEW V where NAME =
'store_xyz'))
group by store_id;
What I'd like to do is to have the store name "NAME" of 'store_xyz' displayed on my out put as well.
I've tried to modify the query like this:
select sv.name, rv.store_id, sum(amount + freight) Total from
report_stores_view sv, REPORT_TRANSACTION_VIEW rv
where TRANSACTION_DATE >= 936158400 and TRANSACTION_DATE <= 938664000
and transaction_type != '3'
and rv.STORE_ID =
(select store_id from STORE SS where SS.KEY_STORE_SEQID =
(select V.KEY_STORE_SEQID from REPORT_STORES_VIEW V where NAME =
'store_xyz'))
group by name, rv.store_id;
My problem is when I try to modify this query to give me the "NAME" as well, I end up getting a list of all the stores, by name and they all have the same "Total" amount, which I know is wrong.
Can anyone make any suggestions that may help me, please?
Thanks
Joe Received on Mon Nov 01 1999 - 09:56:38 CST