Help on implementing conditional count in MYSQL

Report
Question

Please briefly explain why you feel this question should be reported .

Report
Cancel

Hi, I have a table with the following structure

Account_No  D_CD
A1  123
A1  246
A1  XYZ
A1  100
A1  234
A2  123
A2  XYZ
A3  XYZ
A3  246
A3  100

I would like a query that can transform the above data to the below format.
D-CD1   D_CD2   CPD
123 246 
123 XYZ 
123 100 
123 234 
XYZ 123 
XYZ 246 
XYZ 100 
FInally I want to perform count operation on each D_CD combination, the count computation should compute count of common account numbers in each D_CD combination. Any help on this topic will be greatly appreciated.
in progress 0
MySQL 3 weeks 1 Answer 79 views 0

About rai

Answer ( 1 )

  1. ritwik

    Please briefly explain why you feel this answer should be reported .

    Report
    Cancel

    What query you have written till now? What is D_CD2 ?

Leave an answer

Browse

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>