Quantcast
Channel: ฟอรัม Getting started with SQL Server
Viewing all articles
Browse latest Browse all 8428

SQL server 2008

$
0
0

Hi,

I am selecting multiple records from table and joining them.

My query is like this,

SELECT B.ace AS Column1
       K.lastname +' '+ K.firstname AS Column2,
       R.inside AS Column3,
       B.number AS Column4 
      
from Btable B
     left join Ktable K 

     on B.id= K.id       

     left join Other O

     on B.number=O.othernumber    

     left join Rtable R
     on O.somenumber=R.rnumber    
GROUP BY 

                  B.ace,

                  K.lastname +' '+ K.firstname,
                  R.inside
                  B.number

I want to select distinct records of  "K.lastname +' '+ K.firstname" and "R.inside".

I tried giving (SELECT DISTINCT K.lastname +' '+ K.firstname AS Column 2)

but it didn't work. Is there a way to do this?

Thanks


Viewing all articles
Browse latest Browse all 8428

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>