Skip to content

Instantly share code, notes, and snippets.

@snickerjp
Created February 8, 2012 12:20
Show Gist options
  • Save snickerjp/1768914 to your computer and use it in GitHub Desktop.
Save snickerjp/1768914 to your computer and use it in GitHub Desktop.
SQL Study Code
CREATE TABLE data as
select
ID,
sum(PAY_MONEY) as PAY_MONEY
from
SALES
where
ID in (
'AAAA',
'BBBB',
'DDDD'
)
and
YMD >= to_date('20111201')
and
YMD <= to_date('20120101')
group by
ID
order by
ID
select
a.ID,
a.PAY_MONEY,
b.ADDRESS,
c.NAME,
d.EMAIL,
e.ZIP_CD
from
SALES a ,ADDRESS b,NAME c,MAIL d,ZIP e
where
a.ID = b.ID(+)
and
a.ID = c.ID(+)
and
a.ID = d.ID(+)
and
a.ID = e.ID(+)
and
a.ID in (
'AAAA',
'BBBB',
'EEEE'
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment