473,327 Members | 1,997 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

How Two JOINS from one table

ree
I got this problem where I need to look up values in two columns from
another table.

I can get OUTER LEFT JOIN working when looking up one column from a table
but when looking up at two columns from a table I can't get the SQL syntax
correct.

The scenario is
A table has definitions for abbreviation of initials. From my search query
there are two columns of initials, I am having problems in writing an SQL
statement to look up and replace both columns of initials with their
correct definitions. I was using an OUTER LEFT JOIN statement
I am sorry if this isnt the correct Newsgroup to post this.
Jul 20 '05 #1
3 1829
ree
Great, now show us DDL+sample data + expected result.

"ree" <re*@hotmail.coom> wrote in message
news:Xn****************************@211.29.133.50. ..
I got this problem where I need to look up values in two columns from
another table.

I can get OUTER LEFT JOIN working when looking up one column from a table
but when looking up at two columns from a table I can't get the SQL syntax
correct.

The scenario is
A table has definitions for abbreviation of initials. From my search query there are two columns of initials, I am having problems in writing an SQL
statement to look up and replace both columns of initials with their
correct definitions. I was using an OUTER LEFT JOIN statement
I am sorry if this isnt the correct Newsgroup to post this.

Jul 20 '05 #2

"ree" <re*@hotmail.coom> wrote in message
news:Xn****************************@211.29.133.50. ..
I got this problem where I need to look up values in two columns from
another table.

I can get OUTER LEFT JOIN working when looking up one column from a table
but when looking up at two columns from a table I can't get the SQL syntax
correct.

The scenario is
A table has definitions for abbreviation of initials. From my search query there are two columns of initials, I am having problems in writing an SQL
statement to look up and replace both columns of initials with their
correct definitions. I was using an OUTER LEFT JOIN statement
I am sorry if this isnt the correct Newsgroup to post this.

Would be nice to have the query you are trying to run - bit hard to tell you
where you're going wrong otherwise ;-)
Jul 20 '05 #3
ree <re*@hotmail.coom> wrote in message news:<Xn****************************@211.29.133.50 >...
I got this problem where I need to look up values in two columns from
another table.

I can get OUTER LEFT JOIN working when looking up one column from a table
but when looking up at two columns from a table I can't get the SQL syntax
correct.

The scenario is
A table has definitions for abbreviation of initials. From my search query
there are two columns of initials, I am having problems in writing an SQL
statement to look up and replace both columns of initials with their
correct definitions. I was using an OUTER LEFT JOIN statement
I am sorry if this isnt the correct Newsgroup to post this.


Without DDL, sample data and expected results this is a complete guess
(using MSSQL syntax):

update
dbo.MyTable
set
col1 = isnull(a.Definition,col1),
col2 = isnull(b.Definition,col2)
from
dbo.MyTable t
left outer join dbo.Abbreviations a
on t.col1 = a.Abbreviation
left outer join dbo.Abbreviations b
on t.col2 = b.Abbreviation

Simon
Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: jgalzic | last post by:
Hi, I'm having trouble doing joins correctly on two tables. I've read up a lot about the different types of joins and tried lots of variations on inner, outer, and left joins with no avail....
3
by: TH | last post by:
Hi, Trying to get a grip on the "join" thing :) Up until now, I allways used this kinda method: "(select t1.a from t1 where t1.b in (select t2.ab from t2 where t2.b=0))" How can this be...
3
by: Prem | last post by:
Hi, I am having many problems with inner join. my first problem is : 1) I want to know the precedance while evaluating query with multiple joins. eg. select Employees.FirstName,...
7
by: Steve | last post by:
I have a SQL query I'm invoking via VB6 & ADO 2.8, that requires three "Left Outer Joins" in order to return every transaction for a specific set of criteria. Using three "Left Outer Joins"...
4
by: Scott Marquardt | last post by:
My SQL acumen stems from just a couple courses, and everything since from the trenches. Fun + angst over time. I'm needing some advice on joins. Though I understand the basics, I'm having...
3
by: sks | last post by:
I have a table that contains keywords (Varchars) each one mapped to a product. so the database schema is just an id column, product column and keyword column. I want to select the products that...
20
by: p175 | last post by:
Hi people, I have a stored procedure that creates many Global temporary session tables. Into each of these tables go the results of various processing using relational division all keyed and...
2
by: beargrease | last post by:
I'm kind of comfortable with basic joins, but a current project requires a complex query of many tables. The GROUP_CONCAT(DISTINCT ...) function has been very useful as returning my values as comma...
1
by: Ana RM | last post by:
Mark.Powell@eds.com (Mark D Powell) wrote in message news:<2687bb95.0308010642.1fc4ff1f@posting.google.com>... Hi Mark, Thanks por answer me. I do not think it is important thw warehouse...
36
by: TC | last post by:
I've used Access for many years. Several times, I've encountered a bug which I refer to as the "Vanishing Joins" bug. When it happens, joins vanish randomly from queries. More specifically, all...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.