PDA

View Full Version : Querry from MsSQl through ODBC



rkn10
06-12-2006, 01:05 AM
I Have a Inventory table in MSSQL where the stock is maintained on site or location basis in the following manner.

Itemno
Description
Location ID
Quantity On Hand

I. e for the same item no , if there are stocks at different places you will find more tnan one row in the table.

I want to present this data in the form of an excel report where the columns will be

Item no , Description , Qty on hand -location A, Qty on Hand-location B, Total qty on hand

so that I have one one row per item and the location ID becomes a column heading.

This is to enable our sales force to send out stock lists to prospectve customers who are not concerned with which location I have the stock.

I am currently using a crosss tab querry which I find it cumber some .

Can some one help me with a SQL querry which will bring the data in the above format

Thank you