Click here to Skip to main content
15,888,984 members
Home / Discussions / Database
   

Database

 
AnswerRe: Do I need a pivot Query? Pin
Mycroft Holmes16-Jan-13 19:36
professionalMycroft Holmes16-Jan-13 19:36 
GeneralRe: Do I need a pivot Query? Pin
GREG_DORIANcod17-Jan-13 1:59
professionalGREG_DORIANcod17-Jan-13 1:59 
AnswerRe: Do I need a pivot Query? Pin
Jörgen Andersson21-Jan-13 8:58
professionalJörgen Andersson21-Jan-13 8:58 
QuestionTotals of each transaction type Pin
Richard.Berry10015-Jan-13 21:38
Richard.Berry10015-Jan-13 21:38 
AnswerRe: Totals of each transaction type Pin
Mycroft Holmes15-Jan-13 22:57
professionalMycroft Holmes15-Jan-13 22:57 
GeneralRe: Totals of each transaction type Pin
Richard.Berry10016-Jan-13 0:36
Richard.Berry10016-Jan-13 0:36 
GeneralRe: Totals of each transaction type Pin
PIEBALDconsult16-Jan-13 3:42
mvePIEBALDconsult16-Jan-13 3:42 
GeneralRe: Totals of each transaction type Pin
Richard.Berry10016-Jan-13 5:36
Richard.Berry10016-Jan-13 5:36 
Thanks PIEBALDconsult

The problem was amongst other things the dates !!

This works now:
SELECT user_id, 
SUM(CASE WHEN (stkhstm.transaction_type = 'RECP' AND stkhstm.movement_date >= {ts '2012-01-01 00:00:00'} AND stkhstm.movement_date < {ts '2013-01-01 00:00:00'})  then 1 else 0 end)  , 
SUM(CASE WHEN (stkhstm.transaction_type = 'SRET' AND stkhstm.movement_date >= {ts '2012-01-01 00:00:00'} AND stkhstm.movement_date < {ts '2013-01-01 00:00:00'}) then 1 else 0 end)  
FROM vektron.scheme.stkhstm stkhstm
GROUP BY user_id


'BETWEEN' would be a bit more elegant I guess Smile | :)
QuestionCustomize color coding in SQL editor window Pin
biop.codeproject15-Jan-13 20:04
biop.codeproject15-Jan-13 20:04 
AnswerRe: Customize color coding in SQL editor window Pin
Mycroft Holmes15-Jan-13 22:51
professionalMycroft Holmes15-Jan-13 22:51 
GeneralMessage Closed Pin
16-Jan-13 19:26
biop.codeproject16-Jan-13 19:26 
GeneralRe: Customize color coding in SQL editor window Pin
Mycroft Holmes16-Jan-13 19:34
professionalMycroft Holmes16-Jan-13 19:34 
GeneralRe: Customize color coding in SQL editor window Pin
Shameel22-Jan-13 4:41
professionalShameel22-Jan-13 4:41 
Questionquery.. Pin
vishal.v.patil14-Jan-13 17:49
vishal.v.patil14-Jan-13 17:49 
AnswerRe: query.. Pin
Mycroft Holmes14-Jan-13 17:54
professionalMycroft Holmes14-Jan-13 17:54 
GeneralRe: query.. Pin
vishal.v.patil14-Jan-13 18:21
vishal.v.patil14-Jan-13 18:21 
GeneralRe: query.. Pin
Blue_Boy15-Jan-13 3:11
Blue_Boy15-Jan-13 3:11 
QuestionBuilding dictionary translation Pin
Y@ssco14-Jan-13 16:19
Y@ssco14-Jan-13 16:19 
AnswerRe: Building dictionary translation Pin
Mycroft Holmes14-Jan-13 17:52
professionalMycroft Holmes14-Jan-13 17:52 
GeneralRe: Building dictionary translation Pin
Y@ssco14-Jan-13 18:41
Y@ssco14-Jan-13 18:41 
GeneralRe: Building dictionary translation Pin
Mycroft Holmes14-Jan-13 18:52
professionalMycroft Holmes14-Jan-13 18:52 
GeneralRe: Building dictionary translation Pin
Corporal Agarn15-Jan-13 1:51
professionalCorporal Agarn15-Jan-13 1:51 
GeneralRe: Building dictionary translation Pin
Y@ssco15-Jan-13 18:23
Y@ssco15-Jan-13 18:23 
AnswerRe: Building dictionary translation Pin
Eddy Vluggen16-Jan-13 2:41
professionalEddy Vluggen16-Jan-13 2:41 
Questionembedding sql server express in application Pin
Danzy8313-Jan-13 16:48
Danzy8313-Jan-13 16:48 

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.