beyondrelational.com



Joining Results of two Datasets Avoiding Dulicates

rated by 0 users
Not Answered This post has 0 verified answers | 4 Replies | 2 Followers

Top 150 Contributor
4 Posts
Points 125
poncho posted on 01-28-2010 8:11 AM

I want to join the results given by two queries and avoid duplicates in this is there any way to do so.

  • Filed under:
  • | Post Points: 20

All Replies

Top 10 Contributor
Male
92 Posts
Points 785
You can use UNION to join results of two datasets. Hope this will help
  • | Post Points: 20
Top 150 Contributor
4 Posts
Points 125

Hi Ashish

Thanks for help but i am getting this error not sure what is this as i am a newbie to SQL. here is the error...

All queries combined using a UNION, INTERSECT or EXCEPT operator must have an equal number of expressions in their target lists.

  • | Post Points: 35
Top 150 Contributor
5 Posts
Points 60

the error suggests that you need to have same number of columns on all the queries separated by UNION. Also datatypes of corresponding columns in queries should be same (i.e if 3rd column in first query is int then 3rd column in other queries should also be int or some value which can be casted to int.

  • | Post Points: 5
Top 10 Contributor
129 Posts
Points 1,245

poncho:

Hi Ashish

Thanks for help but i am getting this error not sure what is this as i am a newbie to SQL. here is the error...

All queries combined using a UNION, INTERSECT or EXCEPT operator must have an equal number of expressions in their target lists.

 

Post the code you used

  • | Post Points: 5
Page 1 of 1 (5 items) | RSS
Copyright © Beyondrelational.com