Re: query
From: Hugo Kornelis (hugo_at_pe_NO_rFact.in_SPAM_fo)
Date: 05/13/04
- Next message: Matt Tapia: "Case Senstivity on SQL Server"
- Previous message: Freger: "query"
- In reply to: Freger: "query"
- Next in thread: anonymous_at_discussions.microsoft.com: "Re: query"
- Reply: anonymous_at_discussions.microsoft.com: "Re: query"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 13 May 2004 11:29:15 +0200
On Thu, 13 May 2004 02:18:23 -0700, Freger wrote:
>Hi
>
>I have a column in an SQL table. the column is all numeric
>data from 100 to more than 400. I would like to convert
>the data in this column to something else. e.g.
>
>micro = <200
>mini = between 200 and 300
>midi = between 300 and 400
>full > 400
>
>can anyone advise me how to write a query to establish the
>above task.
>
>Thank you.
>
>Freger
Hi Freger,
This can be accomplished using CASE:
SELECT CASE
WHEN (NumericData <= 200)
THEN 'Micro'
WHEN (NumericData <= 300)
THEN Mini'
WHEN (NumericData <= 400)
THEN 'Midi'
ELSE 'Full'
END AS ColumnAlias
FROM YourTable
Replace column and table names as appropriate.
Best, Hugo
-- (Remove _NO_ and _SPAM_ to get my e-mail address)
- Next message: Matt Tapia: "Case Senstivity on SQL Server"
- Previous message: Freger: "query"
- In reply to: Freger: "query"
- Next in thread: anonymous_at_discussions.microsoft.com: "Re: query"
- Reply: anonymous_at_discussions.microsoft.com: "Re: query"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|