473,406 Members | 2,620 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,406 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.
Nov 23 '05 #1
1 1047
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
Nov 23 '05 #2

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
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.