Microsoft
Software
Hardware
Network
Question : Sql Question
I have this table:
points | type | name
100 | 1 | John
100 | 1 | micke
100 | 3 | johen
100 | 2 | Peter
100 | 3 | Micke
I whant this reults:
Name | pointsTYP1 | Points TYP2 | points TYP3
John | 500 | 555 | 1100
Micke | 545 | 5151 | 5150
Who can i do this with 1 sql?
Answer : Sql Question
Or you could do:
SELECT name, SUM(CASE WHEN type = 1 THEN points ELSE 0 END) as pointsType1, SUM(CASE WHEN type = 2 THEN points ELSE 0 END) as pointsType2, SUM(CASE WHEN type = 3 THEN points ELSE 0 END) as pointsType3 FROM table
GROUP BY name
Random Solutions
Change GUID in VStudio C++ OCX
Creating a directory path string based on choices in a form
Excluding duplicates from a query in t-sql to use in MS Visual Studio
MS Project and SQL Server
tweaking my stored proc
SBS 2003 Network Configuration and DCHP
Expert Notify Thread - For Experts only (those answering questions in the MS Access Zone).
Append from Access to SQL Server key violation on any second query
Can I use GPO to uninstall IE 8 ?
wpf validation xaml textbox