Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have 2 tables in sql 

table 1- ContributerSubCategoryMapping

ID	Subcatid	ContributorID	LocationId
1	1	2	379
2	2	2	379
3	4	3	379
4	32	2	379
5	41	2	379
6	45	2	379
7	4	412	379
8	5	412	379
9	41	408	1328
10	45	408	1328
11	4	3	1328
12	6	4	1328
13	7	7	1328


Table 2 - PhotographerContributors_tbl

ContributorId	Pswd	FirstName	LastName
1	       123	  Ravi	        asdddd
2	       456	  Deepak	dddd
3	       789	  ramesh	asd
4	       876	  Parveen	sad
5	       234	  Sandeep	asda


I have create a join below 


SQL
select PhotographerContributors_tbl.* , tbl_City.City as Cityname from ContributerSubCategoryMapping
  left outer join PhotographerContributors_tbl on PhotographerContributors_tbl.ContributorId=ContributerSubCategoryMapping.ContributorID
  left outer join tbl_City on tbl_City.CityID=ContributerSubCategoryMapping.LocationId
  where  ContributerSubCategoryMapping.Subcatid in (1,2,3,4,5,6,7)



result is showing fine but i want to create distinct on ContributorID from the ContributerSubCategoryMapping table.

Waiting for your valuable replies :)
Posted
Comments
Pheonyx 14-Aug-14 3:57am    
Give us an example of what sort out output you are looking for, it might help us clarify what you are trying to achieve.
Animesh Datta 14-Aug-14 3:58am    
please put your previous result set and also explain what you want ?

1 solution

use "distinct" keyword in sql

eg:

SQL
select Distinct name1...
 
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