Click here to Skip to main content
13,145,603 members (43,917 online)
Rate this:
 
Please Sign up or sign in to vote.
See more:
2.Columns UOM1 and UOM2

UOM1        UOM2
---         ---
PIECES      BOX



what I want to display in combobox is

PIECES
BOX


How could I write to get that fromat.

OP's additional content moved from non-solution below
thanks for your reply (solution 1 by _TR_)

3Columns Produtct_Id, UOM1 and UOM2 in a table

Product_Id     UOM1       UOM2
-----------     ---        ---
   1.          PIECES      BOX
   2.          BOTTLE      CTN
   3.          PACKET      BAN



what I want to display in combobox is based on the product_id, while I choose Product_Id 1 from a Combobox, want to bind UOM1 and UOM2 value in the another combobox. Not all the data.

for example: select Product_Id 1.

just only display those two data on combobox.

PIECES
BOX

How should I rewrite the sql statement?
Although I try to use that statement, show all the data in.

create procedure GetTwoProduct
(
    @id int
)
as
 
SELECT UOM1_Code AS UOM FROM Product
UNION ALL
SELECT UOM2_Code AS UOM FROM Product
where Product.Product_Id = @id
Posted 1-Dec-12 23:43pm
ttds941
Updated 2-Dec-12 7:43am
Nelek136.6K
v2

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Assuming you are retrieving data from database, you can try
SELECT UOM1 AS UOM FROM [YourTable]
UNION ALL
SELECT UOM2 AS UOM FROM [YourTable]


The columns UOM1 and UOM2 should be of same data type.

Let me know if you have any doubts.
  Permalink  
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy |
Web02 | 2.8.170915.1 | Last Updated 2 Dec 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100