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

Database

 
QuestionHOW TO IMPLEMENT MULTIVALUED ATTRIBUTES Pin
robin70029-Sep-11 23:15
robin70029-Sep-11 23:15 
AnswerRe: HOW TO IMPLEMENT MULTIVALUED ATTRIBUTES Pin
Shameel30-Sep-11 0:01
professionalShameel30-Sep-11 0:01 
AnswerRe: HOW TO IMPLEMENT MULTIVALUED ATTRIBUTES Pin
Ganu Sharma5-Oct-11 1:39
Ganu Sharma5-Oct-11 1:39 
QuestionSQL SERVER 2008 Express Backup and Restore using SMO does not effect database Pin
kutbinayi27-Sep-11 5:22
kutbinayi27-Sep-11 5:22 
AnswerRe: SQL SERVER 2008 Express Backup and Restore using SMO does not effect database Pin
Mycroft Holmes27-Sep-11 14:16
professionalMycroft Holmes27-Sep-11 14:16 
QuestionSelect Multi Row, to be Singel Row Pin
Naunt26-Sep-11 20:05
Naunt26-Sep-11 20:05 
AnswerRe: Select Multi Row, to be Singel Row Pin
Mycroft Holmes26-Sep-11 21:28
professionalMycroft Holmes26-Sep-11 21:28 
QuestionRe: Select Multi Row, to be Singel Row Pin
Naunt26-Sep-11 21:45
Naunt26-Sep-11 21:45 
Oh! yes such a simple case Smile | :) I didn't get that idea. Thank you.

But, Any Idea again?
To get this data I had to use the following query, the query is already complicated.
Is there any way to Sum up the data as you suggested without dumping this data into temp Table?

SQL
NGB	CCU	0	0	0	0	0	0	0	0	6
NGB	CCU	0	0	0	0	0	0	4	0	0
SHA	SIN	0	0	0	0	0	0	0	0	4
SHA	SIN	0	0	0	0	0	0	0	1	0
SHA	SIN	0	0	0	0	0	0	25	0	0

SQL
-- Get Refeer, Open Top/Flatrack and Normal
with myTable(POL,POD,Container_Code,qty) as 
(Select Distinct POL,POD,Container_Code,SUM(qty) as 'Qty'
from TableF 
Where account_name like '%Freight%' and account_name not like '%FREIGHT REBATE'
Group by POL,POD,Container_Code
)
select Distinct POL,POD,
	(case  when container_code like '%R%20' Then qty else '' end ) as 'R_D20',
	0 as 'R_D40',
	(case  when container_code like '%HR%40' Then qty else '' end ) as 'R_H40',
	(case  when container_code ='FL20' OR container_code ='OT20' Then qty else '' end ) as 'OT_D20',
	(case  when container_code ='FL40' OR container_code ='OT40' Then qty else '' end ) as 'OT_D40',
	0 as 'OT_H40',
	(case when container_code='D20' Then qty else '' end ) as 'N_D20',
	(case  when container_code='D40' Then qty else '' end ) as 'N_D40', 
	(case when container_code='HC40' Then qty else '' end ) as 'N_H40'
From myTable
order by POL,POD


modified 27-Sep-11 3:55am.

AnswerRe: Select Multi Row, to be Singel Row Pin
Jörgen Andersson27-Sep-11 11:54
professionalJörgen Andersson27-Sep-11 11:54 
GeneralRe: Select Multi Row, to be Singel Row Pin
Naunt27-Sep-11 16:16
Naunt27-Sep-11 16:16 
AnswerRe: Select Multi Row, to be Singel Row Pin
Ganu Sharma5-Oct-11 2:05
Ganu Sharma5-Oct-11 2:05 
GeneralRe: Select Multi Row, to be Singel Row Pin
Naunt5-Oct-11 14:56
Naunt5-Oct-11 14:56 
QuestionData warehous Pin
apadana_198926-Sep-11 9:31
apadana_198926-Sep-11 9:31 
AnswerRe: Data warehous Pin
Mycroft Holmes26-Sep-11 13:09
professionalMycroft Holmes26-Sep-11 13:09 
QuestionDatabase Size Pin
megasoft house25-Sep-11 19:43
megasoft house25-Sep-11 19:43 
AnswerRe: Database Size Pin
loyal ginger26-Sep-11 2:43
loyal ginger26-Sep-11 2:43 
AnswerRe: Database Size Pin
Eddy Vluggen26-Sep-11 12:17
professionalEddy Vluggen26-Sep-11 12:17 
QuestionSQL Servier 2008 Pin
megasoft house25-Sep-11 19:33
megasoft house25-Sep-11 19:33 
AnswerRe: SQL Servier 2008 Pin
Luc Pattyn25-Sep-11 21:49
sitebuilderLuc Pattyn25-Sep-11 21:49 
QuestionDo we need to promote SP's anymore? Pin
Mehdi Gholam24-Sep-11 22:29
Mehdi Gholam24-Sep-11 22:29 
AnswerRe: Do we need to promote SP's anymore? PinPopular
Mycroft Holmes24-Sep-11 23:39
professionalMycroft Holmes24-Sep-11 23:39 
GeneralRe: Do we need to promote SP's anymore? Pin
Mehdi Gholam25-Sep-11 0:17
Mehdi Gholam25-Sep-11 0:17 
GeneralRe: Do we need to promote SP's anymore? Pin
Mycroft Holmes25-Sep-11 2:12
professionalMycroft Holmes25-Sep-11 2:12 
GeneralRe: Do we need to promote SP's anymore? Pin
Mehdi Gholam25-Sep-11 9:10
Mehdi Gholam25-Sep-11 9:10 
GeneralRe: Do we need to promote SP's anymore? Pin
Mycroft Holmes25-Sep-11 12:44
professionalMycroft Holmes25-Sep-11 12:44 

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.