Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


join 2 text fields


join 2 text fields

Author
Message
emailcooney
emailcooney
Forum Newbie
Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)

Group: General Forum Members
Points: 7 Visits: 25
i have made a db contain these table with these values

CREATE TABLE tblCompeditors (CompID AutoIncrement,MemberID TEXT(100),FirstName text(100),LastName TEXT(100),Address1 TEXT(100),Address2 TEXT(100),Town TEXT(100),County TEXT(100),PostCode Text(15),Phone Byte,Email TEXT(100),Sex TEXT(10),DOB Date,Club TEXT(100))

CREATE TABLE tblRaceEnterants (CompID LONG,RaceNumber Integer,RaceID TEXT(100),LateEntry TEXT)

CREATE TABLE tblRaceEvents (RaceID TEXT(100),RaceLocation Text,Discription text, DateOn Date)

i have to join all 3 together but havin a problem on the join statment i think i'm missing something

SELECT tblResults.FinishPosition,tblRaceEnterants.RaceNumber,tblResults.FinishTime, tblResults.Age FROM tblResults
INNER JOIN tblRaceEnterants ON tblResults.RaceID = tblRaceEnterants.RaceID INNER JOIN tblCompeditors ON tblResults.CompID = tblCompeditors.CompID
WHERE (tblResults.RaceID = 'FELIXSTOWE-5_KM-25/08/2010');

i can get either with just one join but i need to join both to get the info i need

any help would be great cheers cooney txtPost_CommentEmoticon(':-D');
WayneS
WayneS
SSCertifiable
SSCertifiable (6.2K reputation)SSCertifiable (6.2K reputation)SSCertifiable (6.2K reputation)SSCertifiable (6.2K reputation)SSCertifiable (6.2K reputation)SSCertifiable (6.2K reputation)SSCertifiable (6.2K reputation)SSCertifiable (6.2K reputation)

Group: General Forum Members
Points: 6243 Visits: 10403
emailcooney (8/25/2010)
i have made a db contain these table with these values

CREATE TABLE tblCompeditors (CompID AutoIncrement,MemberID TEXT(100),FirstName text(100),LastName TEXT(100),Address1 TEXT(100),Address2 TEXT(100),Town TEXT(100),County TEXT(100),PostCode Text(15),Phone Byte,Email TEXT(100),Sex TEXT(10),DOB Date,Club TEXT(100))

CREATE TABLE tblRaceEnterants (CompID LONG,RaceNumber Integer,RaceID TEXT(100),LateEntry TEXT)

CREATE TABLE tblRaceEvents (RaceID TEXT(100),RaceLocation Text,Discription text, DateOn Date)

i have to join all 3 together but havin a problem on the join statment i think i'm missing something

SELECT tblResults.FinishPosition,tblRaceEnterants.RaceNumber,tblResults.FinishTime, tblResults.Age FROM tblResults
INNER JOIN tblRaceEnterants ON tblResults.RaceID = tblRaceEnterants.RaceID INNER JOIN tblCompeditors ON tblResults.CompID = tblCompeditors.CompID
WHERE (tblResults.RaceID = 'FELIXSTOWE-5_KM-25/08/2010');

i can get either with just one join but i need to join both to get the info i need

any help would be great cheers cooney txtPost_CommentEmoticon(':-D');


Well, your query references a "tblResults", which you didn't provide any DDL for. Could it be that you're joining to the wrong table?

You might want to read the first link in my signature, then post some (fake) sample data that shows the problem, and what the expected results should be based on that sample data.

Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
If you can't explain to another person how the code that you're copying from the internet works, then DON'T USE IT on a production system! After all, you will be the one supporting it!
Links: For better assistance in answering your questions, How to ask a question, Performance Problems, Common date/time routines,
CROSS-TABS and PIVOT tables Part 1 & Part 2, Using APPLY Part 1 & Part 2, Splitting Delimited Strings

emailcooney
emailcooney
Forum Newbie
Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)

Group: General Forum Members
Points: 7 Visits: 25
Cheers for the reply just got it kind of working by putting in brackets

SELECT tblResults.FinishPosition,tblRaceEnterants.RaceNumber,tblResults.FinishTime, tblResults.Age FROM ((tblResults
INNER JOIN tblRaceEnterants ON tblResults.RaceID = tblRaceEnterants.RaceID) INNER JOIN tblCompeditors ON tblResults.CompID = tblCompeditors.CompID)
WHERE (tblResults.RaceID = 'FELIXSTOWE-5_KM-25/08/2010');

but i now seem to get an extra column ???????http://www.sqlservercentral.com/Forums/Skins%5CClassic%5CImages/MessageIcons/Whistling.gif
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search