Click here to Skip to main content
15,749,281 members
Home / Discussions / Database
   

Database

 
GeneralRe: OR in a JOIN Pin
Paul Conrad5-Jun-12 19:15
professionalPaul Conrad5-Jun-12 19:15 
GeneralRe: OR in a JOIN Pin
PIEBALDconsult6-Jun-12 3:46
professionalPIEBALDconsult6-Jun-12 3:46 
GeneralRe: OR in a JOIN Pin
Paul Conrad6-Jun-12 7:38
professionalPaul Conrad6-Jun-12 7:38 
GeneralRe: OR in a JOIN Pin
PIEBALDconsult6-Jun-12 9:12
professionalPIEBALDconsult6-Jun-12 9:12 
GeneralRe: OR in a JOIN Pin
Paul Conrad6-Jun-12 9:16
professionalPaul Conrad6-Jun-12 9:16 
AnswerRe: OR in a JOIN Pin
pmpdesign5-Jun-12 19:34
pmpdesign5-Jun-12 19:34 
GeneralRe: OR in a JOIN Pin
PIEBALDconsult6-Jun-12 3:24
professionalPIEBALDconsult6-Jun-12 3:24 
AnswerRe: OR in a JOIN Pin
Bernhard Hiller5-Jun-12 21:09
Bernhard Hiller5-Jun-12 21:09 
GeneralRe: OR in a JOIN Pin
PIEBALDconsult6-Jun-12 3:26
professionalPIEBALDconsult6-Jun-12 3:26 
AnswerRe: OR in a JOIN Pin
Chris Meech6-Jun-12 4:30
Chris Meech6-Jun-12 4:30 
GeneralRe: OR in a JOIN Pin
PIEBALDconsult6-Jun-12 5:55
professionalPIEBALDconsult6-Jun-12 5:55 
GeneralRe: OR in a JOIN Pin
Chris Meech6-Jun-12 6:56
Chris Meech6-Jun-12 6:56 
GeneralRe: OR in a JOIN Pin
PIEBALDconsult6-Jun-12 9:10
professionalPIEBALDconsult6-Jun-12 9:10 
GeneralRe: OR in a JOIN Pin
Chris Meech6-Jun-12 10:07
Chris Meech6-Jun-12 10:07 
AnswerRe: OR in a JOIN Pin
Paul Conrad6-Jun-12 9:43
professionalPaul Conrad6-Jun-12 9:43 
GeneralRe: OR in a JOIN Pin
PIEBALDconsult6-Jun-12 10:38
professionalPIEBALDconsult6-Jun-12 10:38 
AnswerRe: OR in a JOIN Pin
Luc Pattyn7-Jun-12 4:33
sitebuilderLuc Pattyn7-Jun-12 4:33 
Your modified message is much clearer. And this is what works for me:

SELECT * FROM TableA A INNER JOIN TableB B ON A.Field1=B.Field1
UNION ALL
SELECT * FROM TableA A INNER JOIN TableB B ON A.Field2=B.Field2
WHERE NOT A.ID IN (SELECT A.ID FROM TableA A INNER JOIN TableB B ON A.Field1=B.Field1)


just 3 SELECTs, no LEFT

PS: I failed to get it to work with a CTE on SQL Server...

Smile | :)
Luc Pattyn [My Articles] Nil Volentibus Arduum


modified 7-Jun-12 11:24am.

GeneralRe: OR in a JOIN Pin
Bernhard Hiller7-Jun-12 22:47
Bernhard Hiller7-Jun-12 22:47 
GeneralRe: OR in a JOIN Pin
Luc Pattyn8-Jun-12 2:22
sitebuilderLuc Pattyn8-Jun-12 2:22 
AnswerRe: OR in a JOIN Pin
Jörgen Andersson7-Jun-12 6:51
professionalJörgen Andersson7-Jun-12 6:51 
AnswerRe: OR in a JOIN Pin
Luc Pattyn7-Jun-12 7:23
sitebuilderLuc Pattyn7-Jun-12 7:23 
GeneralRe: OR in a JOIN Pin
Jörgen Andersson7-Jun-12 8:13
professionalJörgen Andersson7-Jun-12 8:13 
QuestionTransposing SQL Record Pin
Frank Lepkowski4-Jun-12 8:22
Frank Lepkowski4-Jun-12 8:22 
AnswerRe: Transposing SQL Record Pin
David Mujica4-Jun-12 9:56
David Mujica4-Jun-12 9:56 
GeneralRe: Transposing SQL Record Pin
FrankLepkowski4-Jun-12 11:04
FrankLepkowski4-Jun-12 11:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.