Click here to Skip to main content
16,016,301 members
Home / Discussions / Database
   

Database

 
AnswerRe: Retrieve stored procedures. Each Procedure in separate file. SQL 2008 R2 Pin
UNCRushFan21-Jun-11 5:26
UNCRushFan21-Jun-11 5:26 
QuestionMy Ox is Flummed! Pin
TheComputerMan20-Jun-11 15:18
TheComputerMan20-Jun-11 15:18 
AnswerRe: My Ox is Flummed! Pin
jschell21-Jun-11 8:49
jschell21-Jun-11 8:49 
GeneralRe: My Ox is Flummed! Pin
TheComputerMan21-Jun-11 9:00
TheComputerMan21-Jun-11 9:00 
GeneralRe: My Ox is Flummed! Pin
jschell22-Jun-11 9:15
jschell22-Jun-11 9:15 
GeneralRe: My Ox is Flummed! Pin
TheComputerMan22-Jun-11 9:23
TheComputerMan22-Jun-11 9:23 
GeneralRe: My Ox is Flummed! Pin
jschell22-Jun-11 9:29
jschell22-Jun-11 9:29 
QuestionTrying to get the output of this code down to 1 line vs 1886 it currently displays. Can anyone help? Pin
SQL Ed20-Jun-11 9:49
SQL Ed20-Jun-11 9:49 
Trying to get the output of this code down to 1 line vs 1886 it currently displays. When I remove the ship date it gives me an error. Can anyone help?



/* This template is an aging report for private pay open balances*/

USE AR

SELECT SUM(ARO.TOTALAMOUNT) AS SUM_OF_TOTALAMOUNT,ARO.INS_CO_AR,
--CONVERT(VARCHAR, CLM.SHIP_DT_CH, 101) AS SHIP_DATE,
--CONVERT(VARCHAR, GETDATE(), 102) AS CUR_DATE,
--DATEDIFF(dd, CLM.SHIP_DT_CH, GETDATE()) AS AGE,

CASE
WHEN DATEDIFF(dd,CLM.SHIP_DT_CH, GETDATE()) <=30
THEN SUM(ARO.TOTALAMOUNT)
ELSE 0
END AS [0-30 DAYS],

CASE
WHEN DATEDIFF(dd,CLM.SHIP_DT_CH, GETDATE()) >=31
AND DATEDIFF(dd,CLM.SHIP_DT_CH, GETDATE()) <=60
THEN SUM(ARO.TOTALAMOUNT)
ELSE 0
END AS [31-60 DAYS],


CASE
WHEN DATEDIFF(dd,CLM.SHIP_DT_CH, GETDATE()) >=61
AND DATEDIFF(dd,CLM.SHIP_DT_CH, GETDATE()) <=90
THEN SUM(ARO.TOTALAMOUNT)
ELSE 0
END AS [61-90 DAYS],


CASE
WHEN DATEDIFF(dd,CLM.SHIP_DT_CH, GETDATE()) >=91
AND DATEDIFF(dd,CLM.SHIP_DT_CH, GETDATE()) <=180
THEN SUM(ARO.TOTALAMOUNT)
ELSE 0
END AS [91-180 DAYS],

CASE
WHEN DATEDIFF(dd,CLM.SHIP_DT_CH, GETDATE()) >=181
AND DATEDIFF(dd,CLM.SHIP_DT_CH, GETDATE()) <=360
THEN SUM(ARO.TOTALAMOUNT)
ELSE 0
END AS [181-360 DAYS],

CASE
WHEN DATEDIFF(dd,CLM.SHIP_DT_CH, GETDATE()) >=361
THEN SUM(ARO.TOTALAMOUNT)
ELSE 0
END AS [OVER 360 DAYS]

FROM dbo.tblAROPEN AS ARO

INNER JOIN dbo.tblCLMHDR AS CLM
ON ARO.CUS_NUM_AR = CLM.CUSTNUM_CH
AND ARO.APPLY_TO_AR = CLM.fINVNUM_CH




WHERE ARO.INS_CO_AR IN ('0','000')
AND ARO.TOTALAMOUNT >0

GROUP BY ARO.INS_CO_AR, CLM.SHIP_DT_CH

--ORDER BY ARO.TOTALAMOUNT DESC
AnswerRe: Trying to get the output of this code down to 1 line vs 1886 it currently displays. Can anyone help? Pin
Tim Carmichael20-Jun-11 10:25
Tim Carmichael20-Jun-11 10:25 
QuestionRe: Trying to get the output of this code down to 1 line vs 1886 it currently displays. Can anyone help? Pin
SQL Ed21-Jun-11 6:24
SQL Ed21-Jun-11 6:24 
AnswerRe: Trying to get the output of this code down to 1 line vs 1886 it currently displays. Can anyone help? [modified] Pin
TrustTheMath21-Jun-11 9:00
TrustTheMath21-Jun-11 9:00 
QuestionSQL Update Statement, OleDbDataAdapter, and ms access 2007 Pin
VonHagNDaz17-Jun-11 8:05
VonHagNDaz17-Jun-11 8:05 
AnswerRe: SQL Update Statement, OleDbDataAdapter, and ms access 2007 Pin
Matt U.19-Jun-11 6:40
Matt U.19-Jun-11 6:40 
QuestionKeep history table [modified] Pin
Rahul.RK14-Jun-11 20:05
Rahul.RK14-Jun-11 20:05 
AnswerRe: Keep history table Pin
_Damian S_14-Jun-11 20:32
professional_Damian S_14-Jun-11 20:32 
AnswerRe: Keep history table Pin
FeatherstoneBC15-Jun-11 7:37
FeatherstoneBC15-Jun-11 7:37 
AnswerRe: Keep history table Pin
jschell15-Jun-11 9:08
jschell15-Jun-11 9:08 
AnswerArchive Pin
David Mujica16-Jun-11 2:54
David Mujica16-Jun-11 2:54 
AnswerRe: Keep history table Pin
Simon_Whale16-Jun-11 6:28
Simon_Whale16-Jun-11 6:28 
QuestionHow to get reference information between parent and child tables (MS SQL Server/MSAccess)? [modified] Pin
priyamtheone13-Jun-11 19:51
priyamtheone13-Jun-11 19:51 
AnswerRe: How to get reference information between parent and child tables (MS SQL Server/MSAccess)? Pin
_Damian S_13-Jun-11 20:09
professional_Damian S_13-Jun-11 20:09 
GeneralRe: How to get reference information between parent and child tables (MS SQL Server/MSAccess)? Pin
priyamtheone13-Jun-11 21:12
priyamtheone13-Jun-11 21:12 
AnswerRe: How to get reference information between parent and child tables (MS SQL Server/MSAccess)? Pin
Simon_Whale13-Jun-11 22:42
Simon_Whale13-Jun-11 22:42 
AnswerRe: How to get reference information between parent and child tables (MS SQL Server/MSAccess)? Pin
Mycroft Holmes14-Jun-11 1:20
professionalMycroft Holmes14-Jun-11 1:20 
QuestionSelect records from a single table that have common data in two columns Pin
Frank Lepkowski13-Jun-11 10:43
Frank Lepkowski13-Jun-11 10:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.