Click here to Skip to main content
15,887,363 members
Home / Discussions / Database
   

Database

 
GeneralSQL IF statement Pin
DBLearner15-Apr-09 8:31
DBLearner15-Apr-09 8:31 
GeneralRe: SQL IF statement Pin
Luc 64801115-Apr-09 8:47
Luc 64801115-Apr-09 8:47 
GeneralRe: SQL IF statement Pin
DBLearner15-Apr-09 9:00
DBLearner15-Apr-09 9:00 
GeneralRe: SQL IF statement Pin
Luc 64801115-Apr-09 9:02
Luc 64801115-Apr-09 9:02 
GeneralRe: SQL IF statement Pin
Ashfield15-Apr-09 9:47
Ashfield15-Apr-09 9:47 
GeneralRe: SQL IF statement Pin
DBLearner17-Apr-09 1:08
DBLearner17-Apr-09 1:08 
GeneralRe: SQL IF statement Pin
Ashfield17-Apr-09 1:49
Ashfield17-Apr-09 1:49 
QuestionAny shorter way to total this? Pin
Muammar©14-Apr-09 21:10
Muammar©14-Apr-09 21:10 
Hey everyone,
Just wondering if there's a better way to do this:
SELECT
SUM(LOOOOOOOOONG EXPRESSION) AS EX1,
SUM(ANOTHER LONG EXPRESSION) AS EX12,
SUM(LOOOOOOOOONG EXPRESSION)+SUM(ANOTHER LONG EXPRESSION) AS TOTAL
FROM SOME_TABLE

Can't it just be
SELECT
SUM(LOOOOOOOOONG EXPRESSION) AS EX1,
SUM(ANOTHER LONG EXPRESSION) AS EX12,
EX1+EX2 AS TOTAL
FROM SOME_TABLE

Anyway to make this possible??
Thanks!


All generalizations are wrong, including this one!
(\ /)
(O.o)
(><)

AnswerRe: Any shorter way to total this? Pin
Giorgi Dalakishvili14-Apr-09 21:30
mentorGiorgi Dalakishvili14-Apr-09 21:30 
GeneralRe: Any shorter way to total this? Pin
Muammar©15-Apr-09 0:03
Muammar©15-Apr-09 0:03 
GeneralRe: Any shorter way to total this? Pin
Eddy Vluggen15-Apr-09 0:28
professionalEddy Vluggen15-Apr-09 0:28 
GeneralRe: Any shorter way to total this? Pin
Muammar©15-Apr-09 0:44
Muammar©15-Apr-09 0:44 
AnswerRe: Any shorter way to total this? [modified] Pin
Eddy Vluggen15-Apr-09 2:50
professionalEddy Vluggen15-Apr-09 2:50 
GeneralRe: Any shorter way to total this? Pin
Muammar©15-Apr-09 10:36
Muammar©15-Apr-09 10:36 
AnswerRe: Any shorter way to total this? Pin
Mycroft Holmes15-Apr-09 1:21
professionalMycroft Holmes15-Apr-09 1:21 
GeneralRe: Any shorter way to total this? Pin
Muammar©15-Apr-09 10:30
Muammar©15-Apr-09 10:30 
AnswerRe: Any shorter way to total this? Pin
i.j.russell15-Apr-09 9:06
i.j.russell15-Apr-09 9:06 
GeneralRe: Any shorter way to total this? Pin
Muammar©15-Apr-09 10:30
Muammar©15-Apr-09 10:30 
QuestionRewrite recursive proc so we can do this in UDF instead? (and more efficient) Pin
devvvy14-Apr-09 18:02
devvvy14-Apr-09 18:02 
AnswerRe: Rewrite recursive proc so we can do this in UDF instead? (and more efficient) Pin
Ashfield14-Apr-09 21:00
Ashfield14-Apr-09 21:00 
GeneralGot recursive CTE sql but... two more questions. Pin
devvvy15-Apr-09 0:07
devvvy15-Apr-09 0:07 
GeneralRe: Got recursive CTE sql but... two more questions. Pin
Giorgi Dalakishvili15-Apr-09 1:13
mentorGiorgi Dalakishvili15-Apr-09 1:13 
GeneralRe: Got recursive CTE sql but... two more questions. Pin
i.j.russell15-Apr-09 9:10
i.j.russell15-Apr-09 9:10 
GeneralRe: Got recursive CTE sql but... two more questions. Pin
devvvy15-Apr-09 13:25
devvvy15-Apr-09 13:25 
QuestionTABLE VALUE FUNCTION for MySQL? Pin
devvvy14-Apr-09 16:20
devvvy14-Apr-09 16:20 

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.