Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««12

Combining two query result sets. Expand / Collapse
Author
Message
Posted Tuesday, May 14, 2013 8:22 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: 2 days ago @ 8:23 AM
Points: 2,873, Visits: 5,189
Lynn Pettis (5/14/2013)
Eugene Elutin (5/14/2013)
William Gary Wright (5/14/2013)
I left the office last night being half way done writing a script to create a database with some data in it for you all to look at. I came in this morning and read the new replies to my post. I had never considered a join. All of the examples of joins I have seen there was always an = involved and I had not seen >= used in a join. This worked great and it makes sense to me.

Thanks Lynn,
Bill

PS
How does this points thing work?


This article is worth to read (about hidden "RBAR" in triangular joins):

http://www.sqlservercentral.com/articles/T-SQL/61539/


Eugene,

Yes, it is a good article on triangular joins, I just hope you don't think that the code I provided is a triangular join. It is actually a bound join with a lower an upper bound.



No, it has nothing to do with your code. Just OP has stated that he has never seen JOINs with "<=" used before. So, I thought, before OP will became to excited about it, he better to be aware of triangular join problem which may occur when "non-equal" compare is used in joins.


_____________________________________________
"The only true wisdom is in knowing you know nothing"
"O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!"
(So many miracle inventions provided by MS to us...)

How to post your question to get the best and quick help
Post #1452613
Posted Tuesday, May 14, 2013 10:02 AM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Today @ 11:09 AM
Points: 20,806, Visits: 32,738
Eugene Elutin (5/14/2013)
Lynn Pettis (5/14/2013)
Eugene Elutin (5/14/2013)
William Gary Wright (5/14/2013)
I left the office last night being half way done writing a script to create a database with some data in it for you all to look at. I came in this morning and read the new replies to my post. I had never considered a join. All of the examples of joins I have seen there was always an = involved and I had not seen >= used in a join. This worked great and it makes sense to me.

Thanks Lynn,
Bill

PS
How does this points thing work?


This article is worth to read (about hidden "RBAR" in triangular joins):

http://www.sqlservercentral.com/articles/T-SQL/61539/


Eugene,

Yes, it is a good article on triangular joins, I just hope you don't think that the code I provided is a triangular join. It is actually a bound join with a lower an upper bound.



No, it has nothing to do with your code. Just OP has stated that he has never seen JOINs with "<=" used before. So, I thought, before OP will became to excited about it, he better to be aware of triangular join problem which may occur when "non-equal" compare is used in joins.


Okay, just wanted to be sure. Didn't want the article to scare off the OP from the code I provided.

Definitely a good thing to point out the issues that can occur with triangular joins.



Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Post #1452695
« Prev Topic | Next Topic »

Add to briefcase ««12

Permissions Expand / Collapse