September 15, 2010 at 11:11 am
I have two databases I need to join on. Issue is the project number on one is missing fist two digits. I need to append to that number then match against other database field and return a result. Here is the query I am trying.
SELECT *
FROM TimeDetailNew TimeAlias
LEFT OUTER JOIN PM1.PM70.Projects PM1Alias
ON TimeAlias.[Worked Project] = PM1Alias.MJH_Number
WHERE (PM1Alias.MJH_Number = '10' + TimeAlias.[Worked Project])
September 15, 2010 at 2:48 pm
Does it work?
_____________
Code for TallyGenerator
September 15, 2010 at 2:51 pm
No. It compiles fine but when it runs it does not match whats in the MJH_Number column. I get NULL's nor does it concat the [worked task] column.
September 15, 2010 at 2:52 pm
Richard Holloway (9/15/2010)
I have two databases I need to join on. Issue is the project number on one is missing fist two digits. I need to append to that number then match against other database field and return a result. Here is the query I am trying.SELECT *
FROM TimeDetailNew TimeAlias
LEFT OUTER JOIN PM1.PM70.Projects PM1Alias
ON TimeAlias.[Worked Project] = PM1Alias.MJH_Number
WHERE (PM1Alias.MJH_Number = '10' + TimeAlias.[Worked Project])
Try placing the same "join" in the where clause on the join
SELECT *
FROM TimeDetailNew TimeAlias
LEFT OUTER JOIN PM1.PM70.Projects PM1Alias
ON '10' + TimeAlias.[Worked Project] = PM1Alias.MJH_Number
-- Cory
September 15, 2010 at 2:57 pm
Cool! That worked...now how do I keep it from selecting NULL in the MJH_Number column? Its over 160852 rows and takes a while but if I eliminate the NULL's that would be that much quicker. 😉
September 15, 2010 at 2:57 pm
inner join
-- Cory
September 15, 2010 at 3:00 pm
SWEET! That worked...Pretty easy now that I look back at it. Thanks a MILLION!! 😀
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply