问题描述
美好的一天伙计
我有一张桌子
有两列
订单和状态
订单可以多次包含相同的订单号
状态可以包含1到9
我想选择状态为8但状态不是9的所有订单
任何帮助都是赞赏
亲切的问候
Good day Guys
I have a table
with two columns
order and status
order can contain the same order number multiple times
status can contain 1 to 9
I want to select all the orders which have a status of 8 but not a status of 9
Any assistance would be appreciated
Kind regards
推荐答案
select order,status from Table_Name where status=8
或1到8的记录:
Or Records from 1 to 8 :
select order,status from Table_Name where status<=8
ColOrder Colstatus
o1 1
o1 2
o1 3
o1 4
o1 5
o1 6
o1 7
o1 8
o2 1
o2 2
o2 3
o2 4
o2 5
o2 6
o2 7
o2 8
o2 9
o3 1
o3 2
o3 3
o3 4
o3 5
o3 6
o3 7
o3 8
ColOrderColstatus
o11
o12
o13
o14
o15
o16
o17
o18
o21
o22
o23
o24
o25
o26
o27
o28
o29
o31
o32
o33
o34
o35
o36
o37
o38
亲切的问候
Kind regards
这篇关于sql获取列具有特定值的所有行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!