Thread View: borland.public.interbase.sql
3 messages
3 total messages
Started by Isaac
Thu, 05 Jun 2008 22:18
join to a table with different values in the same row
Author: Isaac
Date: Thu, 05 Jun 2008 22:18
Date: Thu, 05 Jun 2008 22:18
19 lines
1357 bytes
1357 bytes
Hello, I need to make select sql to get me the following 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 Thanks
Re: join to a table with different values in the same row
Author: Wayne Niddery (TeamB)
Date: Fri, 06 Jun 2008 02:35
Date: Fri, 06 Jun 2008 02:35
30 lines
2007 bytes
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)
Re: join to a table with different values in the same row
Author: Isaac
Date: Fri, 06 Jun 2008 16:15
Date: Fri, 06 Jun 2008 16:15
30 lines
1931 bytes
1931 bytes
Wayne Niddery (TeamB) wrote: > "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 > ok I will try it thanks
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads