반응형
SELECT SUM(CASE WHEN InOut_Code = '01' THEN CAST((CONVERT(MONEY, Price_unit) * InOut_Count) AS DECIMAL(38)) END) as a ,
SUM(CASE WHEN InOut_Code = '02' THEN CAST((CONVERT(MONEY, Consumer_Price) * InOut_Count) AS DECIMAL(38)) END) as b,
SS = (((SELECT SUM(CASE WHEN InOut_Code = '01' THEN CAST((CONVERT(MONEY, Price_unit) * InOut_Count) AS DECIMAL(38)) END) FROM Goods_Info G, Stock_Info S WHERE G.Goods_Code = S.Goods_Code AND InOut_Day >= '2009-02-24 05:35' AND InOut_Day <= '2009-02-27 05:35' )) -
(SELECT SUM(CASE WHEN InOut_Code = '02' THEN CAST((CONVERT(MONEY, Consumer_Price) * InOut_Count) AS DECIMAL(38)) END) FROM Goods_Info G, Stock_Info S
WHERE G.Goods_Code = S.Goods_Code AND InOut_Day >= '2009-02-24 05:35' AND InOut_Day <= '2009-02-27 05:35' ))
FROM Goods_Info G, Stock_Info S
WHERE G.Goods_Code = S.Goods_Code
AND InOut_Day >= '2009-02-24 05:35'
AND InOut_Day <= '2009-02-27 05:35'
'Database' 카테고리의 다른 글
pl/sql developer 사용법 - pl sql developer test window cursor (0) | 2013.10.11 |
---|---|
SQL vs Oracle (0) | 2010.06.29 |
간단한 전자결재 ERD (2) | 2009.10.23 |
ex) 자료.게시판 설문조사 DB (0) | 2009.10.21 |
DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") Datetime DB 넣는 형식 데이터타임 넣기 (0) | 2009.02.23 |
C:\Program Files\Microsoft SQL Server\MSSQL.2\MSSQL\Data DATABASE 위치 Database 위치 SQL 위치 (0) | 2009.02.19 |
DB자료 복구 RESTORE DATABASE ~ WITH MOVE TO 테스트 하기 iis70 (0) | 2009.02.18 |
DB 저장 프로시저 작성법 프로시저 PROC C# 코드 (0) | 2009.01.28 |