Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
gavakie
Posting Yak Master
221 Posts |
Posted - 2011-04-04 : 16:58:59
|
| I have table and at any time one table could have more then the next but that oculd change as well. How do I join on the table with the most data? |
|
|
Seventhnight
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2011-04-04 : 17:06:37
|
describe 'join on'...what does having more mean?seems to be a bit of an odd requirement.Select From(Select * From(Select tName = 't1', * From t1Union All Select tName = 't2', * From t2) AWhere tname = case when (select count(*) from t1) > (select count(*) from t2) then 't1' else 't2' end) ZJoin someOtherTableOn blah blah blahCorey I Has Returned!! |
 |
|
|
gavakie
Posting Yak Master
221 Posts |
Posted - 2011-04-04 : 17:12:00
|
| So I need these to be on the same lines I have a table saySelect * From SalesAlso tableSelect * From ConnectsOne Day Sales could have more record one day connects could I need to join on the common key but make sure all the data from all tables always shows.Ive Tried a full join on one column but it still brings just the common lines like its doing an inner join. |
 |
|
|
Seventhnight
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2011-04-05 : 06:58:24
|
Show us what you tried when you did your full join... if you put a where clause on the full join, it's likely that you unintentionally filtered out data you wanted to see.Corey I Has Returned!! |
 |
|
|
|
|
|