Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / August 2007

Tip: Looking for answers? Try searching our database.

Trouble joining 3 tables

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JJ297 - 24 Aug 2007 18:56 GMT
I'm getting incorrect syntax error.  Can someone tell me what I'm
doing wrong, here's my stored procedure:

select Titles.Title

>From Titles

Inner Join Titleclassification on classifications.classificationid =
titleclassification.classificationid
Inner Join titlecassification.titleid = titles.titleid
Steve - 24 Aug 2007 19:12 GMT
Try this:

select Titles.Title
From Titles
Inner Join Titleclassification on classifications.classificationid =
titleclassification.classificationid
and titlecassification.titleid = titles.titleid

Steve C.
MCAD,MCSE,MCP+I,CNE,CNA,CCNA

> I'm getting incorrect syntax error.  Can someone tell me what I'm
> doing wrong, here's my stored procedure:
[quoted text clipped - 6 lines]
> titleclassification.classificationid
> Inner Join titlecassification.titleid = titles.titleid
JJ297 - 24 Aug 2007 19:26 GMT
> Try this:
>
[quoted text clipped - 19 lines]
>
> - Show quoted text -

Almost now I'm getting:

The column prefix 'classifications' does not match with a table name
or alias name used in the query.

select Titles.Title
>From Titles
Inner Join Titleclassification on classifications.classificationid =
titleclassification.classificationid
and titleclassification.titleid = titles.titleid

Any ideas?
Steve - 24 Aug 2007 19:34 GMT
oops, how about this:

select Titles.Title
From Titles
Inner Join titlecassification on titlecassification.titleid = titles.titleid
Inner Join classifications on classifications.classificationid =
titleclassification.classificationid

Steve C.
MCAD,MCSE,MCP+I,CNE,CNA,CCNA

>> Try this:
>>
[quoted text clipped - 28 lines]
>
> Any ideas?
JJ297 - 24 Aug 2007 19:39 GMT
> oops, how about this:
>
[quoted text clipped - 41 lines]
>
> - Show quoted text -

PERFECT!  I see you added the word inner join twice.  I get it now.
Thanks!
Steve - 24 Aug 2007 19:48 GMT
Great!

You specify "INNER JOIN" for each table you want to perform the inner
join on, and use the "<table.column>=<table.column>" notation for each
one so SQL knows how to match up the rows. This applies for Left and
Right joins, too.

Steve C.
MCAD,MCSE,MCP+I,CNE,CNA,CCNA

>> oops, how about this:
>>
[quoted text clipped - 36 lines]
> PERFECT!  I see you added the word inner join twice.  I get it now.
> Thanks!

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.