我有一个名为 tblClients 的表,其中包含以下字段:idClient、姓名、信用、债务。
Create table tblClients(idClient int,name varchar(20), credit int, debt int);
insert into tblClients values(1,'Guillermo',1000,0),(2,'Jess',5000,2000);
我想对债务类型进行分类,例如
debt = 0 NOT DEBTOR
debt between 0 AND 1000 LOW DEBTOR
debt between 1001 AND 2000 MEDIUM DEBTOR.
如果我进行此查询,我会得到债务人类型。
SELECT name AS 'Client',debt AS 'Debtor Type' FROM tblClients WHERE debt = 0;
SELECT name AS 'Client',debt AS 'Debtor Type' FROM tblClients WHERE debt BETWEEN 1 AND 1000;
我怎样才能把标签DEBTOR
,LOW DEBTOR
或者MEDIUM DEBTOR
在债务列而不是债务编号?