Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.databases.ms-sqlserver > #777

One to many issue

From srgebauer@gmail.com
Newsgroups comp.databases.ms-sqlserver
Subject One to many issue
Date 2011-11-02 13:15 -0700
Organization http://groups.google.com
Message-ID <21551923.2109.1320264930406.JavaMail.geo-discussion-forums@yqgn17> (permalink)

Show all headers | View raw


I have a two tables, Stock and Bin, with Stock having one to Bin's many. Stock has  fields Number and Desc1 and Bin has Number, Warehouse, and Units. I would like to join Stock and Bin on Number and use the value in Bin.warehouse as a field name with Bin.units as the value. 

For Example:
Stock table
Number....Desc1
100.....WidgetA
110.....WidgetB

Bin Table
Number...Warehouse...Units
100...NCWARE...10
100...PAWARE...15
100...OS1NC...100
110...NCWARE...20
110...PAWARE...30

Output would be:
Number...Desc1...NCWARE...PAWARE...OS1NC
100...WidgetA...10...15...100
110...WidgetB...20...30...0

Is this possible? Thanks
Shane

Back to comp.databases.ms-sqlserver | Previous | NextNext in thread | Find similar


Thread

One to many issue srgebauer@gmail.com - 2011-11-02 13:15 -0700
  Re: One to many issue Hugo Kornelis <hugo@perFact.REMOVETHIS.info.INVALID> - 2011-11-02 22:59 +0100
  Re: One to many issue srgebauer@gmail.com - 2011-11-03 13:31 -0700

csiph-web