Click here to Skip to main content
15,896,374 members
Home / Discussions / Database
   

Database

 
AnswerRe: Penetration testing of ORACLE DATABASE Pin
Pete O'Hanlon4-Oct-11 3:28
mvePete O'Hanlon4-Oct-11 3:28 
AnswerRe: Penetration testing of ORACLE DATABASE Pin
Randor 11-Oct-11 21:08
professional Randor 11-Oct-11 21:08 
AnswerRe: Penetration testing of ORACLE DATABASE Pin
HARISHCHOWDHARY12-Oct-11 3:11
HARISHCHOWDHARY12-Oct-11 3:11 
QuestionSQL Query Pin
uspatel30-Sep-11 21:17
professionaluspatel30-Sep-11 21:17 
AnswerRe: SQL Query Pin
Luc Pattyn1-Oct-11 3:22
sitebuilderLuc Pattyn1-Oct-11 3:22 
AnswerRe: SQL Query Pin
PIEBALDconsult1-Oct-11 4:11
mvePIEBALDconsult1-Oct-11 4:11 
GeneralRe: SQL Query Pin
uspatel2-Oct-11 21:27
professionaluspatel2-Oct-11 21:27 
AnswerRe: SQL Query Pin
Eddy Vluggen1-Oct-11 8:47
professionalEddy Vluggen1-Oct-11 8:47 
AnswerRe: SQL Query Pin
Niladri_Biswas3-Oct-11 7:14
Niladri_Biswas3-Oct-11 7:14 
AnswerRe: SQL Query Pin
Ganu Sharma5-Oct-11 1:32
Ganu Sharma5-Oct-11 1:32 
AnswerRe: SQL Query Pin
uspatel13-Oct-11 2:48
professionaluspatel13-Oct-11 2:48 
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 

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.