Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/71.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql 选择两列之间的范围_Mysql_Sql - Fatal编程技术网

Mysql 选择两列之间的范围

Mysql 选择两列之间的范围,mysql,sql,Mysql,Sql,我需要查询来选择到列之间的值,但有一列具有相同的值 例如: 12 1 12 2 12 3 ------ 12 4 12 5 13 1 13 2 13 3 13 4 ------ 13 5 我需要从12 | 3到13 | 4的范围 select * from table1 where ((a >= '12' and B >= 2) and (a <= '13' and b <=5)) 从表1中选择*,其中 (a>='12'和B>=2)和(a

我需要查询来选择到列之间的值,但有一列具有相同的值 例如:

12  1
12  2
12  3  ------
12  4
12  5
13  1
13  2
13  3
13  4  ------
13  5
我需要从12 | 3到13 | 4的范围

select * from table1 where
((a >=  '12' and B >= 2) and (a <=  '13' and b <=5)) 
从表1中选择*,其中
(a>='12'和B>=2)和(a我认为逻辑是:

where (a > 12 and a < 13) or
      (a = 12 and b >= 3) or
      (a = 13 and b <= 4)
其中(a>12和a<13)或
(a=12且b>=3)或
(a=13和b=(12,3)和
(a,b)我认为逻辑是:

where (a > 12 and a < 13) or
      (a = 12 and b >= 3) or
      (a = 13 and b <= 4)
其中(a>12和a<13)或
(a=12且b>=3)或
(a=13和b=(12,3)和
(a,b)这肯定会奏效:

select * from Table1 where 
(a=12 and b>=3) or(a=13 and b<=4);
从表1中选择*,其中
(a=12和b>=3)或(a=13和b这肯定会起作用:

select * from Table1 where 
(a=12 and b>=3) or(a=13 and b<=4);
从表1中选择*,其中
(a=12和b>=3)或(a=13和b我认为这是可行的:

从测试中选择* 其中(a=12和b>2)或(a=13和b<5);

我认为这是可行的:

从测试中选择*
其中(a=12且b>2)或(a=13且b<5)

表格中的值是数字还是文本?12,3和13,4是否需要包含,或者只是12,4-13,3?从12,3到13,4???需要什么输出!!!表格中的值是数字还是文本?12,3和13,4是否需要包含,或者只是12,4-13,3?从12,3到13,4???需要什么输出!!!元组似乎最简单;但是值需要更改,或者我们需要使用just>和<可能需要调整到(12,3)和(13,4)@simon…它们都是固定的。元组似乎最简单;但是值需要更改,或者我们需要使用just>和<可能需要调整到(12,3)和(13,4)@simon…它们都是固定的。我想你想要
b=3
@xQbert我已将用户想要的行从3更正为9我想你想要
b=3
@xQbert我已将用户想要的行从3更正为9