Re: Display date in oracle based on flag

From: Samuel Leung <kalawuf_at_ctimail3.com>
Date: Wed, 17 Oct 2001 16:46:49 +0800
Message-ID: <9qjgch$f32$1_at_news.ctimail.com>


Hi,

The following query may suit you:

select date, sale#, 'book', sum(book)
from tablename
where flag_book = 'Y'
group by date, sale#, 'book'
union
select date, sale#, 'audio', sum(audio)
from tablename
where flag_audio = 'Y'
group by date, sale#, 'audio'
order by 1, 2

Samuel
kalawuf_at_hotmail.com

"sgupta" <sugandha_g_at_yahoo.com> wrote in message news:62deede6.0110160534.597afdae_at_posting.google.com...
> My apologies if this seems elementary but I am new . I have a oracle
> table with fields
>
> Date sale # Flag_book Flag_audio Book Audio
> XXX 1 Y Y 3 1
> XXX 2 Y N 3 0
>
> I want to use ap to display it as this on a webpage. Any help with
> queries is appreciated. Thanks in advance!
>
> Date Sale # item_type no
> XXX 1 book 3
> XXX 1 audio 1
> XXX 2 book 3
>
> Thanks very much. Any help appreciated
Received on Wed Oct 17 2001 - 10:46:49 CEST

Original text of this message