Oct 30, 2001 #1 JCooL Programmer Joined Oct 21, 2001 Messages 89 Location US How do i create a several condiction in a SQL's View like a field? i.e. CASE WHEN [age]<=20 THEN [Expr3]ELSE 0 END AS Age1 CASE WHEN [age]>=30 THEN [Expr3]ELSE 0 END AS Age2 i test this but unly with the first line and is perfect... Thanx to Advanced
How do i create a several condiction in a SQL's View like a field? i.e. CASE WHEN [age]<=20 THEN [Expr3]ELSE 0 END AS Age1 CASE WHEN [age]>=30 THEN [Expr3]ELSE 0 END AS Age2 i test this but unly with the first line and is perfect... Thanx to Advanced
Oct 30, 2001 #2 tlbroadbent MIS Joined Mar 16, 2001 Messages 9,982 Location US You'll probably want to summarize on some key columns. Sum(CASE WHEN [age]<=20 THEN [Expr3] ELSE 0 END) AS Age1 Sum(CASE WHEN [age]>=30 THEN [Expr3] ELSE 0 END) AS Age2 . . . GROUP BY keycol1, keycol2 Terry L. Broadbent FAQ183-874 contains tips for posting questions in these forums. NOTE: Reference to the FAQ is not directed at any individual. Upvote 0 Downvote
You'll probably want to summarize on some key columns. Sum(CASE WHEN [age]<=20 THEN [Expr3] ELSE 0 END) AS Age1 Sum(CASE WHEN [age]>=30 THEN [Expr3] ELSE 0 END) AS Age2 . . . GROUP BY keycol1, keycol2 Terry L. Broadbent FAQ183-874 contains tips for posting questions in these forums. NOTE: Reference to the FAQ is not directed at any individual.