Change the result format of a true/false column

  • Thread starter Thread starter Guy Cohen
  • Start date Start date
G

Guy Cohen

Hi all.
I would like to change the result coming from a query as follows
Lets say I have a table with columns:
C1 [Long] and C2[Boolean]
select * from mytable returns

1 get results (e.g.):

1 true
2 false
3 true
4 false

I would like to alter the result so true values output "Product A" and false
will output "Product B"

e.g.:

1 Product A
2 Product B
3 Product A
4 Product B

How do I do that with:
VB6+ADO 2.8+MS HFlexgrid

TIA
Guy
 
Hide the C2 column and create a new calculated colmun defined as:

ProductName: IIF([C2], "Product A", "Product B")

Hi all.
I would like to change the result coming from a query as follows
Lets say I have a table with columns:
C1 [Long] and C2[Boolean]
select * from mytable returns

1 get results (e.g.):

1 true
2 false
3 true
4 false

I would like to alter the result so true values output "Product A" and false
will output "Product B"

e.g.:

1 Product A
2 Product B
3 Product A
4 Product B

How do I do that with:
VB6+ADO 2.8+MS HFlexgrid

TIA
Guy


Please respond to the Newsgroup, so that others may benefit from the exchange.
Peter R. Fletcher
 
Try something like
Select C1, 'Product' = CASE
WHEN C2 = False then 'Product B'
ELSE 'Product A'
END
FROM MyTable
HTH,
CF
 
Back
Top