Inner join error



Programming Help Forums
Home       Members    Calendar    Who's On
Welcome Guest ( Login | Register )
        



Inner join error Expand / Collapse
Author
Message
Posted 2/9/2007 7:45:46 AM
Junior Member

Junior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior 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.
Post #261
Posted 5/24/2007 2:01:14 PM
Junior Member

Junior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior 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
Post #678
Posted 7/9/2007 11:11:31 PM
Junior Member

Junior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior Member

Group: Forum Members
Last Login: 7/9/2007 11:05:34 PM
Posts: 10, Visits: 1
thanks

chrissy
Post #1438
Posted 4/3/2009 8:52:38 AM
Junior Member

Junior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior 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 

Post #2530
Posted 11/30/2009 1:08:52 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum 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
Post #4692
Posted 12/11/2009 10:32:53 AM
Junior Member

Junior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior Member

Group: Forum Members
Last Login: 12/11/2009 10:30:59 AM
Posts: 10, Visits: 1
yaaaa.

but icant solve it ///
Post #4731
Posted 1/26/2010 7:05:03 PM
Junior Member

Junior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior 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_
Post #5020
« Prev Topic | Next Topic »


Reading This Topic Expand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: ProgrammingHelp, Viral Unity, Matt.Hill, DaveL, Alex.D

Permissions Expand / Collapse

All times are GMT -5:00, Time now is 4:06am

Powered By InstantForum.NET v4.1.4 © 2010
Execution: 0.062. 9 queries. Compression Disabled.