how to retrieve distinct values from multiple columns
        Posted  
        
            by ANIL MANE
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by ANIL MANE
        
        
        
        Published on 2010-04-21T14:39:54Z
        Indexed on 
            2010/04/21
            14:43 UTC
        
        
        Read the original article
        Hit count: 356
        
Hello Experts,
I have a flat text file data which I import into MSSQL table. It creates and table with specified name along with multiple columns as per data file.
now I need a query which will return the data and its count. e.g.
data file :
BREAD,MILK BREAD,DIAPER,BEER,EGGS MILK,DIAPER,BEER,COKE BREAD,MILK,DIAPER,BEER BREAD,MILK,DIAPER,COKE BREAD,ICE,MANGO JUICE,BURGER
Result should be
BREAD | 5 MILK | 4 DIAPER| 4
and so on.
© Stack Overflow or respective owner