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

Database

 
GeneralRe: Goofy Question About SQL Server Pin
Luc Pattyn20-Apr-10 16:58
sitebuilderLuc Pattyn20-Apr-10 16:58 
AnswerRe: Goofy Question About SQL Server Pin
Johan Hakkesteegt20-Apr-10 20:06
Johan Hakkesteegt20-Apr-10 20:06 
GeneralRe: Goofy Question About SQL Server Pin
Roger Wright22-Apr-10 14:48
professionalRoger Wright22-Apr-10 14:48 
AnswerRe: Goofy Question About SQL Server Pin
PIEBALDconsult21-Apr-10 4:39
mvePIEBALDconsult21-Apr-10 4:39 
GeneralRe: Goofy Question About SQL Server Pin
Roger Wright22-Apr-10 14:50
professionalRoger Wright22-Apr-10 14:50 
GeneralRe: Goofy Question About SQL Server Pin
Johan Hakkesteegt22-Apr-10 21:59
Johan Hakkesteegt22-Apr-10 21:59 
QuestionSQL Group by and Sum () Pin
I Believe In GOD20-Apr-10 7:37
I Believe In GOD20-Apr-10 7:37 
AnswerRe: SQL Group by and Sum () Pin
Stryder_120-Apr-10 8:18
Stryder_120-Apr-10 8:18 
Try:

"Select mat, sum(case type
when 0 then qty * -1
else qty) [Current qty] from MatTable
group by mat"


or if you don't like to use a case statement then -

select mat, sum(qty) from (
(Select mat, sum(qty * -1) qty from MatTable group by mat
where type = 0) t1
union
(Select mat, sum(qty) qty from MatTable group by mat
where type = 1) t2
)
group by mat

I didn't check either of these for syntax so let me know if you have problems running these...
GeneralRe: SQL Group by and Sum () Pin
I Believe In GOD20-Apr-10 10:03
I Believe In GOD20-Apr-10 10:03 
QuestionHow to find a Date from within a Range using Access? Pin
Squire Dude20-Apr-10 5:22
Squire Dude20-Apr-10 5:22 
AnswerRe: How to find a Date from within a Range using Access? Pin
Dr.Walt Fair, PE20-Apr-10 5:49
professionalDr.Walt Fair, PE20-Apr-10 5:49 
GeneralRe: How to find a Date from within a Range using Access? Pin
Squire Dude20-Apr-10 6:55
Squire Dude20-Apr-10 6:55 
GeneralRe: How to find a Date from within a Range using Access? Pin
Dr.Walt Fair, PE20-Apr-10 7:14
professionalDr.Walt Fair, PE20-Apr-10 7:14 
GeneralRe: How to find a Date from within a Range using Access? Pin
Squire Dude20-Apr-10 8:04
Squire Dude20-Apr-10 8:04 
GeneralRe: How to find a Date from within a Range using Access? Pin
Luc Pattyn20-Apr-10 8:24
sitebuilderLuc Pattyn20-Apr-10 8:24 
GeneralRe: How to find a Date from within a Range using Access? Pin
Dr.Walt Fair, PE20-Apr-10 8:43
professionalDr.Walt Fair, PE20-Apr-10 8:43 
GeneralRe: How to find a Date from within a Range using Access? Pin
Luc Pattyn20-Apr-10 9:04
sitebuilderLuc Pattyn20-Apr-10 9:04 
QuestionSQL Server Code Generation Pin
billythekidney20-Apr-10 4:54
billythekidney20-Apr-10 4:54 
AnswerRe: SQL Server Code Generation Pin
Mycroft Holmes20-Apr-10 12:32
professionalMycroft Holmes20-Apr-10 12:32 
GeneralRe: SQL Server Code Generation Pin
billythekidney20-Apr-10 22:26
billythekidney20-Apr-10 22:26 
Questionhow to write insert querry for two tables Pin
developerit20-Apr-10 3:56
developerit20-Apr-10 3:56 
AnswerRe: how to write insert querry for two tables Pin
Ashfield20-Apr-10 9:03
Ashfield20-Apr-10 9:03 
QuestionSQL Server 2008 R2? Is the upgrade from 2008 free? Pin
DoctorOwl19-Apr-10 14:38
DoctorOwl19-Apr-10 14:38 
AnswerRe: SQL Server 2008 R2? Is the upgrade from 2008 free? Pin
Michel Godfroid20-Apr-10 4:15
Michel Godfroid20-Apr-10 4:15 
QuestionHow to do a quick / generic pivot? Pin
DoctorOwl18-Apr-10 16:25
DoctorOwl18-Apr-10 16:25 

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.