Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 SQL Query

Author  Topic 

ani07in
Starting Member

5 Posts

Posted - 2007-01-13 : 08:21:58
I have a product table with list of products and different prices (depending on quantity of item selected, prices for single product(1,2 and 10 Dozen) as inthe table below

Products Table
Id Product Single 1Dozen 2Dozen 10Dozen
1 ABC 5 50 80 400
2 XYZ 10 100 180 800
3 HHHH 2 20 30 180


how do i get the result in the following format after user selects the products


Order Table

User Product Quantity Total
MyName XYZ 24 (2 Dozen) 180
MyName HHH 120 (10 Dozen) 180
MyName ABC 12(1 Dozen) 50



also how do i get totalvalue (410)

i apologise for the display format of above tables on screen
....


Thanx in advance

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-01-13 : 08:28:40
To get Dozen value

select '(' + cast(144 / 12 as varchar) + ' Dozen)' AS Dozen.


Peter Larsson
Helsingborg, Sweden
Go to Top of Page
   

- Advertisement -