Click here to Skip to main content
15,905,028 members
Home / Discussions / Database
   

Database

 
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
mvePIEBALDconsult6-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
mvePIEBALDconsult6-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
mvePIEBALDconsult6-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 
AnswerRe: Transposing SQL Record Pin
Jörgen Andersson4-Jun-12 11:22
professionalJörgen Andersson4-Jun-12 11:22 
AnswerRe: Transposing SQL Record Pin
Mycroft Holmes4-Jun-12 13:11
professionalMycroft Holmes4-Jun-12 13:11 
GeneralRe: Transposing SQL Record Pin
FrankLepkowski4-Jun-12 13:23
FrankLepkowski4-Jun-12 13:23 
GeneralRe: Transposing SQL Record Pin
Mycroft Holmes4-Jun-12 14:12
professionalMycroft Holmes4-Jun-12 14:12 
Questionsmall bank application Pin
mpkuena4-Jun-12 6:51
mpkuena4-Jun-12 6:51 
AnswerRe: small bank application Pin
Paul Conrad4-Jun-12 8:06
professionalPaul Conrad4-Jun-12 8:06 
AnswerRe: small bank application Pin
R. Giskard Reventlov4-Jun-12 8:43
R. Giskard Reventlov4-Jun-12 8:43 
JokeRe: small bank application Pin
Chris Meech4-Jun-12 8:58
Chris Meech4-Jun-12 8:58 
GeneralRe: small bank application Pin
thatraja6-Jun-12 8:46
professionalthatraja6-Jun-12 8:46 

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.