|
|
|
Junior Member
      
Group: Forum Members
Last Login: 2/9/2007 7:35:17 AM
Posts: 15,
Visits: 9
|
|
| I am trying to join table1, table 2 and table3. The table1 has Deal_Id, Prod_Id. Table2 has Deal_Id and Table3 has Prod_Id. Now I want to write a query which will be able to retrieve records from Table3 based on Prod_Id of Table1. I also want to get the records from table2 based from Deal_Id of table1. I was trying inner join and outer join. I am getting errors. Please help.
|
|
|
|
|
Junior Member
      
Group: Forum Members
Last Login: 5/24/2007 2:30:22 PM
Posts: 10,
Visits: 2
|
|
select t2.xxx, '' from table1 t1, table2 t2 where t1.deal_id = t2.deal_id union select t3.xxx, '' from table1 t1, table3 t3 where t3.prod_id = t1.prod_id
|
|
|
|
|
Junior Member
      
Group: Forum Members
Last Login: 7/9/2007 11:05:34 PM
Posts: 10,
Visits: 1
|
|
|
|
|
|
Junior Member
      
Group: Forum Members
Last Login: 4/27/2009 10:10:34 AM
Posts: 11,
Visits: 6
|
|
| You could also try this... select t2.xxx, t3.xxx from table1 t1, table2 t2, table3 t3 where t1.deal_id = t2.deal_id and t3.prod_id = t1.prod_id
|
|
|
|
|
Forum Newbie
      
Group: Forum Members
Last Login: 11/30/2009 9:12:05 AM
Posts: 1,
Visits: 3
|
|
this can help
http://www.techonthenet.com/sql/index.php
|
|
|
|
|
Junior Member
      
Group: Forum Members
Last Login: 12/11/2009 10:30:59 AM
Posts: 10,
Visits: 1
|
|
yaaaa.
but icant solve it ///
|
|
|
|
|
Junior Member
      
Group: Forum Members
Last Login: 1/26/2010 8:21:10 PM
Posts: 10,
Visits: 5
|
|
#
Previously, a USING clause could be rewritten as an ON clause that compares corresponding columns. For example, the following two clauses were semantically identical:
a LEFT JOIN b USING (c1,c2,c3)
a LEFT JOIN b ON a.c1=b.c1 AND a.c2=b.c2 AND a.c3=b.c3
Now the two clauses no longer are quite the same:
*
With respect to determining which rows satisfy the join condition, both joins remain semantically identical.
*
With respect to determining which columns to display for SELECT * expansion, the two joins are not semantically identical. The USING join selects the coalesced value of corresponding columns, whereas the ON join selects all columns from all tables. For the preceding USING join, SELECT * selects these values:
COALESCE(a.c1,b.c1), COALESCE(a.c2,b.c2), COALESCE(a.c3,b.c3)
For the ON join, SELECT * selects these values:
a.c1, a.c2, a.c3, b.c1, b.c2, b.c3
With an inner join, COALESCE(a.c1,b.c1) is the same as either a.c1 or b.c1 because both columns will have the same value. With an outer join (such as LEFT JOIN), one of the two columns can be NULL. That column will be omitted from the result.
_behaxor_
|
|
|
|