Click here to Skip to main content
15,888,351 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
query


select  C.CompanyName ,C.CompanyID,R.URLPart,C.Photo,T.ReportID 
   from  dbo.KALKINE_Company C
 inner join
  dbo.KALKINE_ReportsCompanyTag T
  on C.CompanyID = T.CompanyID 
    inner join dbo.KALKINE_Reports R on R.CompanyID = T.CompanyID
      where T.ReportID =  855


What I have tried:

i tired to get the distinct values of CompanyName ,CompanyID,URLPart
Posted
Updated 17-Mar-16 6:40am
v3
Comments
OriginalGriff 16-Mar-16 8:07am    
And?
Show us samples of the input data tables, the output you want, and the output you get.
Use the "Improve question" widget to edit your question and provide better information.
koolprasad2003 16-Mar-16 8:45am    
The question is looks like INCOMPLETE, you should give us brief scenario and steps you have tried so that we can help you better

To select distinct you need to use the DISTINCT keyword.

SQL
SELECT DISTINCT companyName, CompanyId, URLPart
FROM ...


This will get distinct of the 3 values combined.
 
Share this answer
 
SQL
SELECT DISTINCT C.CompanyName ,C.CompanyID,R.URLPart,C.Photo,T.ReportID
FROM dbo.KALKINE_Company C
WHERE T.ReportID =  855
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900