Click here to Skip to main content
15,922,315 members
Home / Discussions / Database
   

Database

 
AnswerRe: sql stored procedure Pin
N a v a n e e t h4-Jul-07 22:24
N a v a n e e t h4-Jul-07 22:24 
QuestionHave problem with displaying columns as rows Pin
masyarial4-Jul-07 20:35
masyarial4-Jul-07 20:35 
AnswerRe: Have problem with displaying columns as rows Pin
Krish - KP4-Jul-07 21:22
Krish - KP4-Jul-07 21:22 
GeneralRe: Have problem with displaying columns as rows Pin
masyarial5-Jul-07 1:39
masyarial5-Jul-07 1:39 
GeneralRe: Have problem with displaying columns as rows Pin
Krish - KP9-Jul-07 22:23
Krish - KP9-Jul-07 22:23 
GeneralRe: Have problem with displaying columns as rows Pin
masyarial10-Jul-07 1:09
masyarial10-Jul-07 1:09 
GeneralRe: Have problem with displaying columns as rows Pin
Krish - KP10-Jul-07 17:33
Krish - KP10-Jul-07 17:33 
GeneralRe: Have problem with displaying columns as rows Pin
masyarial14-Jul-07 1:15
masyarial14-Jul-07 1:15 
OK Krish you great !!!
I try this code, and it's work.
But after few days, my database is update with more than one record in the same name,
I not tell you that I have another column name 'date',
Regarding I just want to display data depend on last date, like below:

name type value date
-----------------------------------------------------
a A 1 06/10/2007
a B 1 06/10/2007
a C 1 06/10/2007
a A 2 06/13/2007
a B 2 06/13/2007
a C 2 06/13/2007

the code is:
select name,date=max(date),
sum(case when type='A' then value else 0 end) as 'A',
sum(case when type='B' then value else 0 end) as 'B',
sum(case when type='C' then value else 0 end) as 'C'
from table1
group by name

the result is:
name date A B C
-----------------------------------------
a 06/13/2007 3 3 3

I'm expecting like this:
name date A B C
-----------------------------------------
a 06/13/2007 2 2 2

Thank you.
B.regards
Questionhow to join two tables [modified] Pin
harithadotnet4-Jul-07 19:18
harithadotnet4-Jul-07 19:18 
AnswerRe: how to join two tables Pin
Krish - KP4-Jul-07 21:31
Krish - KP4-Jul-07 21:31 
Questionhow to join two tables Pin
harithadotnet4-Jul-07 18:29
harithadotnet4-Jul-07 18:29 
AnswerRe: how to join two tables [modified] Pin
Krish - KP4-Jul-07 18:49
Krish - KP4-Jul-07 18:49 
AnswerRe: how to join two tables Pin
Michael Sync4-Jul-07 18:49
Michael Sync4-Jul-07 18:49 
QuestionHow can I call a DB2 system procedure GET_DBSIZE_INFO by .net? Pin
Jameson_cn4-Jul-07 17:54
Jameson_cn4-Jul-07 17:54 
Questionproblem with GetChanges [modified] Pin
goldoche4-Jul-07 9:14
goldoche4-Jul-07 9:14 
AnswerRe: problem with GetChanges Pin
goldoche4-Jul-07 10:38
goldoche4-Jul-07 10:38 
QuestionUsing a DataSet to insert data in a table througth a sproc Pin
Le centriste4-Jul-07 4:35
Le centriste4-Jul-07 4:35 
AnswerRe: Using a DataSet to insert data in a table througth a sproc Pin
goldoche4-Jul-07 9:46
goldoche4-Jul-07 9:46 
QuestionSQL query... need help Pin
Diana18114-Jul-07 4:02
Diana18114-Jul-07 4:02 
AnswerRe: SQL query... need help Pin
andyharman4-Jul-07 9:00
professionalandyharman4-Jul-07 9:00 
GeneralRe: SQL query... need help Pin
Diana18114-Jul-07 17:28
Diana18114-Jul-07 17:28 
GeneralRe: SQL query... need help Pin
Pete O'Hanlon4-Jul-07 22:29
mvePete O'Hanlon4-Jul-07 22:29 
AnswerRe: SQL query... need help Pin
andyharman4-Jul-07 22:46
professionalandyharman4-Jul-07 22:46 
GeneralRe: SQL query... need help Pin
Diana18116-Jul-07 0:39
Diana18116-Jul-07 0:39 
GeneralFunny with SELECT ... INTO Pin
Brady Kelly3-Jul-07 23:58
Brady Kelly3-Jul-07 23:58 

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.