June 22, 2009 at 10:18 am
Hello -
What is not right below? I am trying to pull a data from another table where 'Inncode' from tblOTSOrder = first 5 character from 'Site_Id' from tblSRO378.
select
tblOTSOrder.InnCode,
tblSRO378.Order
FROM tblOTSOrder
INNER JOIN tblSRO378
ON tblOTSOrder.InnCode = tblSRO378.left(Site_ID,5)
June 22, 2009 at 10:33 am
businessintelligence2010 (6/22/2009)
Hello -What is not right below? I am trying to pull a data from another table where 'Inncode' from tblOTSOrder = first 5 character from 'Site_Id' from tblSRO378.
select
tblOTSOrder.InnCode,
tblSRO378.Order
FROM tblOTSOrder
INNER JOIN tblSRO378
ON tblOTSOrder.InnCode = tblSRO378.left(Site_ID,5)
Should be:
select
tblOTSOrder.InnCode,
tblSRO378.Order
FROM
tblOTSOrder
INNER JOIN tblSRO378
ON tblOTSOrder.InnCode = left(tblSRO378.Site_ID,5)
June 22, 2009 at 10:41 am
Thank you..but I get the following error:
Msg 156, Level 15, State 1, Line 3
Incorrect syntax near the keyword 'Order'.
June 22, 2009 at 10:47 am
Is Order the name of a column in the table? If so, put brackets around it, like this:
tablealias.[Order] -- Please note, I didn't use yout table name, short term memory isn't what it use to be
June 22, 2009 at 10:48 am
Thank you very much...after tweaking few col names, it worked!! Appreciate your time.
June 22, 2009 at 11:12 am
Lynn - One more q's for you. I need to add data from third table now. I need the following code to include in existing code so that I can get the result as a third column in my output.
select
HotelMstr.brand,
tblhoteltype.hotelName
from HotelMstr
inner join tblHoteltype
on HotelMstr.brand = tblHoteltype.hoteltype
June 22, 2009 at 11:19 am
NEI, Not Enough Information. At this point, please read the first article I have referenced below regarding asking for assistance. Without knowing the table definitions and how the four tables are related I can't answer your question from the short code snippets provided.
June 22, 2009 at 11:24 am
Thanks Lynn for the links. I will try my best to explain it better.
Viewing 8 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy