Link to home
Create AccountLog in
Avatar of karon1980

asked on

Distinct Result from 2 tables having Multiple Ids

Hi I have a Situation where in I have to get Distinct Result set from 2 Tables having Multiple Id's. I have my Table structures along with sample data and the Query that I have wrote are
attached as a sql File

POS_ID is Common In Both tables(dbo.Facility (15 Rows) and dbo.FacilityComplexProjMeasure (17 Rows)), I have to write a query where in I should get Distinct Resultset from both the tables
and with the query I wrote it is returning 33 Rows where in I have to get only 31 rows.

I have Inserted the result from my query into a table dbo.ActualResultSet and the data sample for the desired result set in dbo.DesiredResultSet.

The Only issue with the Result set is, I want to restrict ID's 31 and 32 from the Actual Result set.

Is there a way I can get unique result set from the query
Avatar of Haver Ramirez
Haver Ramirez

your data is correct, if you see the attached file, the 3 last rows are different, and in desired result, this lines are in only one, this is not possible, because the 3 lines are different for real
Avatar of karon1980

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of karon1980


With this way, i have got the desired result that I am expecting to see