Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/295.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/67.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
Php 如何订购某一天的节目?_Php_Mysql - Fatal编程技术网

Php 如何订购某一天的节目?

Php 如何订购某一天的节目?,php,mysql,Php,Mysql,我正在尝试查询加入showingdates和showings表,获取某个日期的所有showings并按时间排序 My showingdates dayfield的格式为showdate(datetime)并显示“2013-03-06 00:00:00” My showings performance_date字段也是日期时间,示例如下 "2013-03-06 20:00:00 , "2013-03-06 21:00:00" . 如何查询该日期并按时间排序 这应该行得通 SELECT g

我正在尝试查询加入showingdates和showings表,获取某个日期的所有showings并按时间排序

My showingdates dayfield的格式为showdate(datetime)并显示“2013-03-06 00:00:00”

My showings performance_date字段也是日期时间,示例如下

 "2013-03-06 20:00:00 , 
 "2013-03-06 21:00:00" . 
如何查询该日期并按时间排序

这应该行得通

SELECT garbage
FROM trash
WHERE DATE(showdate) = '2013-03-06'
ORDER BY TIME(showdate) DESC
这里的时间在下降。删除
DESC
以实现升序。

这应该可以

SELECT garbage
FROM trash
WHERE DATE(showdate) = '2013-03-06'
ORDER BY TIME(showdate) DESC

这里的时间在下降。删除
DESC
以实现升序。

仅从特定日期获取行(不使用
showdate
列上的任何函数,因此可以使用索引):


要仅从特定日期获取行(不使用
showdate
列上的任何函数,因此可以使用索引):


如果$showingdate是动态的呢?我的错我问某个日期这是个例子。。sorry@ytsejam您需要显示更多的代码。没有上下文,我无法给出答案。如果$showingdate是动态的,该怎么办?我的错我问某个日期这是个例子。。sorry@ytsejam您需要显示更多的代码。没有上下文,我不能给你答案。
ORDER BY showdate