从今天到明天无法获得正确的mySQL记录

时间:2017-01-09 16:26:35

标签: php mysql

可能会多次询问,但我有一张有一些记录的表格。有些是明天的约会,有些是后天。我尝试以下

SELECT * FROM Games where GAMEID='".$id."' AND GAMEDATE >=CURDATE() + INTERVAL 1 DAY

我得到的日期为10/1/2017和11/1/2017。中午1天不能只获得10/1/2017的日期吗?

如果我使用

GAMEDATE >= DATE_SUB(CURDATE(), INTERVAL 1 DAY) AND GAMEDATE <= CURDATE()

我得到空查询

3 个答案:

答案 0 :(得分:1)

如果你只想明天的记录

尝试此查询

{{1}}

检查演示表

sqlfiddle

答案 1 :(得分:0)

尝试使用var str = "hello world"; console.log(str.length); //11 str = "hello stack overflow"; console.log(str.length); //20

答案 2 :(得分:0)

你不能只使用这样的添加。您需要使用@Test public void partitioning() throws InterruptedException { final int N = 10; Flux<Integer> source = Flux.range(1, 10000).share(); // partition source into publishers Publisher<Integer>[] publishers = new Publisher[N]; for (int i = 0; i < N; i++) { final int idx = i; publishers[idx] = source.filter(v -> v % N == idx); } // create ParallelFlux each 'rail' containing single partition ParallelFlux.from(publishers) // schedule partitions into different threads .runOn(Schedulers.newParallel("proc", N)) // process each partition in its own thread, i.e. in order .map(it -> { String threadName = Thread.currentThread().getName(); Assert.assertEquals("proc-" + (it % 10 + 1), threadName); return it; }) // collect results on single 'rail' .sequential() // and on single thread called 'subscriber-1' .publishOn(Schedulers.newSingle("subscriber")) .subscribe(it -> { String threadName = Thread.currentThread().getName(); Assert.assertEquals("subscriber-1", threadName); }); Thread.sleep(1000); }

DATE_ADD()

如果你想倒退,你将使用GAMEDATE >= DATE_ADD(CURDATE(), INTERVAL 1 DAY);