🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.interbase.sql
Article #112

Re: join to a table with different values in the same row

#112
From: Wayne Niddery (TeamB)
Date: Fri, 06 Jun 2008 02:35
30 lines
2007 bytes
"Isaac" <no@no.com> wrote in message 
news:484865c2$1@newsgroups.borland.com...
>
> tabl1: inventories
> fields: inv_code, inv_name
>
> table2: items
> fields: inv_code, item_code, item_name
>
> table3: transfer_items
> fields: original_inv_code, item_code, new_inv_code(for new inventory)
>
> as you might guessed this is for transferring items quantities between 
> inventories the sql I need is for table3
>
> my question can I display two different inventories names in the same row 
> with join ? if not please advice


Sure...

select  ti.original_inv_code, ti.item_code, ti.new_inv_code,
  iold.item.name as old_inv_name,  inew.item.name as new_inv_name,
inner join inventories iold on iold.inv_code = ti.original_inv_code
inner join inventories inew on inew.inv_code = ti.new_inv_code

-- 

Wayne Niddery - TeamB (www.teamb.com)
Winwright, Inc. (www.winwright.ca) 
Technical Details
Message-ID: <4848a274$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!feeder.erje.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <484865c2$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 114a0e,7e8a00cfc7e3cb68
X-Google-Attributes: gid114a0e,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Wayne Niddery \(TeamB\)" <wniddery@chaffaci.on.ca>
Newsgroups: borland.public.interbase.sql
References: <484865c2$1@newsgroups.borland.com>
In-Reply-To: <484865c2$1@newsgroups.borland.com>
Subject: Re: join to a table with different values in the same row
Date: Thu, 5 Jun 2008 22:35:28 -0400
Lines: 31
MIME-Version: 1.0
Content-Type: text/plain;
 format=flowed;
 charset="iso-8859-1";
 reply-type=response
Content-Transfer-Encoding: 7bit
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Windows Mail 6.0.6001.18000
X-MIMEOLE: Produced By Microsoft MimeOLE V6.0.6001.18000
NNTP-Posting-Host: 24.137.214.213
Message-ID: <4848a274$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1212719732 24.137.214.213 (5 Jun 2008 19:35:32 -0700)
X-Authenticated-User: wniddery
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!feeder.erje.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail