Click here to Skip to main content
15,893,594 members
Home / Discussions / Database
   

Database

 
AnswerRe: showing column data as header Pin
mhwasim11-May-11 7:53
mhwasim11-May-11 7:53 
QuestionSet variable values from queried data Pin
MAW3010-May-11 9:50
MAW3010-May-11 9:50 
AnswerRe: Set variable values from queried data Pin
David Mujica10-May-11 10:40
David Mujica10-May-11 10:40 
AnswerRe: Set variable values from queried data Pin
Simon_Whale10-May-11 11:39
Simon_Whale10-May-11 11:39 
AnswerRe: Set variable values from queried data Pin
SilimSayo11-May-11 3:13
SilimSayo11-May-11 3:13 
QuestionHow do I join for tables together? Pin
Justiin126510-May-11 9:09
Justiin126510-May-11 9:09 
AnswerRe: How do I join for tables together? Pin
Luc Pattyn10-May-11 9:26
sitebuilderLuc Pattyn10-May-11 9:26 
AnswerRe: How do I join for tables together? Pin
SilimSayo11-May-11 7:50
SilimSayo11-May-11 7:50 
Your code is using an implicit equijoin and a cartesianjoin.
WHERE RF.REPAIR_ORD = RH.REPAIR_ORD and Rp.REPAIR_ORD = cg.REPAIR_ORD
For simplicity, let me assume the actual table names are RF, RH, RP and CG. RH and RH are joined and RP and CG are joined but
RF is not joined to RP or CG; and also RH is not joined to RP and CG. So the end result is a cartesian product of two equijoins (RF-RH X RP-CG). I would suggest using an explicit join. From your code, I assume that REPAIR_ORD is common to all the tables. So my code would look like

SELECT .....

FROM 
  RF INNER JOIN RH
  ON RF.REPAIR_ORD=RH.REPAIR_ORD
  
  INNER JOIN RP
  ON RH.REPAIR_ORD=RP.REPAIR_ORD

  INNER JOIN CG
  ON RP.REPAIR_ORD=CG.REPAIRD_ORD

WHERE ....


I am using inner joins but depending on what you need, you may find left joins or right joins more suitable.
QuestionHow do I to mass update date and time? Pin
Justiin12659-May-11 18:06
Justiin12659-May-11 18:06 
AnswerRe: How do I to mass update date and time? Pin
Blue_Boy9-May-11 20:49
Blue_Boy9-May-11 20:49 
GeneralRe: How do I to mass update date and time? Pin
Justiin126510-May-11 3:30
Justiin126510-May-11 3:30 
GeneralRe: How do I to mass update date and time? Pin
Blue_Boy10-May-11 3:59
Blue_Boy10-May-11 3:59 
AnswerRe: How do I to mass update date and time? Pin
Corporal Agarn10-May-11 2:21
professionalCorporal Agarn10-May-11 2:21 
QuestionExecution Plan Caching and Reuse Pin
PIEBALDconsult9-May-11 15:30
mvePIEBALDconsult9-May-11 15:30 
AnswerRe: Execution Plan Caching and Reuse Pin
Luc Pattyn9-May-11 15:33
sitebuilderLuc Pattyn9-May-11 15:33 
GeneralRe: Execution Plan Caching and Reuse Pin
PIEBALDconsult9-May-11 15:59
mvePIEBALDconsult9-May-11 15:59 
QuestionUpdate All records Pin
ivo758-May-11 1:50
ivo758-May-11 1:50 
AnswerRe: Update All records Pin
Luc Pattyn8-May-11 2:42
sitebuilderLuc Pattyn8-May-11 2:42 
GeneralRe: Update All records Pin
ivo758-May-11 3:11
ivo758-May-11 3:11 
AnswerRe: Update All records Pin
Luc Pattyn8-May-11 3:26
sitebuilderLuc Pattyn8-May-11 3:26 
GeneralRe: Update All records Pin
ivo758-May-11 4:48
ivo758-May-11 4:48 
Questionpossible LINQTOSQL active connections Pin
wjbjnr6-May-11 11:44
wjbjnr6-May-11 11:44 
AnswerRe: possible LINQTOSQL active connections Pin
Mycroft Holmes6-May-11 22:35
professionalMycroft Holmes6-May-11 22:35 
AnswerRe: possible LINQTOSQL active connections Pin
jschell9-May-11 9:46
jschell9-May-11 9:46 
QuestionNeed a little help in working with CLOB data, please [modified] Pin
Michael J. Eber6-May-11 8:50
Michael J. Eber6-May-11 8:50 

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.