on 06-06-2007 4:57 PM
For an interface with a JDBC sender, I have 4 tables that need to be joined. For this question, I'll call them tab1,tab2,tab3 and tab4.
I have to join tab1 and tab2 on UNIT where flag = N. This is fine but then I have to join this result with tab3 if the UNIT found in the first join is in tab3 and the flag is = N. I also have to join tab4 to the first join if the UNIT found in the first join is in tab4 and the flag is = N. I've tried using LEFT JOIN but this is no good as it retrieves the UNIT from tab3 and tab4 regardless of the flag being equal to N or Y.
Can anyone suggest a way to do this join?
looks like it is a good candidate for a stored procedure on DB ?!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
you can write the select statement, properly written inner and outer joins should fix it.......let me know if its not clear
Regards
Ravi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
77 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.