Answer the question
In order to leave comments, you need to log in
Is it possible to create such a query in SQL in which numbers are replaced with text?
Hello. I have a table that has some values (orders) and their status (integer value). I want to create a request where the status will change to text.
More or less like this.
0 - will be replaced with "work not started".
1 - "work in progress".
2 - "work done".
Is it possible to write such a query in SQL? Or you need to create two tables - orders and statuses. And to make a query based on these tables?
Answer the question
In order to leave comments, you need to log in
SELECT (CASE
WHEN stat=0
THEN 'работа не начата'
WHEN stat=1
THEN 'работа идет'
WHEN stat=2
THEN 'работа выполнена'
END) AS statStr
FROM table
SELECT ProductName, Manufacturer,
CASE ProductCount
WHEN 1 THEN 'Товар заканчивается'
WHEN 2 THEN 'Мало товара'
WHEN 3 THEN 'Есть в наличии'
ELSE 'Много товара'
END AS EvaluateCount
FROM Products
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question