Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/74.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
表单中的SQL查询,带顺序_Sql_Forms - Fatal编程技术网

表单中的SQL查询,带顺序

表单中的SQL查询,带顺序,sql,forms,Sql,Forms,我有一个疑问: $query = 'SELECT ForteID, Disposition, appNumber, Finance_Num, Num_Payments, ACH_CC, Notes, Date FROM CSLogs.dbo.Logs WHERE ForteID = ' . $_GET['ForteID']; 它工作正常,但我想补充一点: ORDER BY Date DESC 但是,当我在sql Management Studio中时,我可以在sql查询中添加它的唯一位置是在

我有一个疑问:

$query = 'SELECT ForteID, Disposition, appNumber, Finance_Num, Num_Payments, ACH_CC, Notes, Date FROM CSLogs.dbo.Logs WHERE ForteID = ' . $_GET['ForteID'];
它工作正常,但我想补充一点:

ORDER BY Date DESC
但是,当我在sql Management Studio中时,我可以在sql查询中添加它的唯一位置是在Where语句的末尾,但该语句的结尾是'after Where ForteID=。因此,添加orderby不起作用,会破坏代码。有什么建议吗?

您是否尝试过:

$query = 'SELECT ForteID, Disposition, appNumber, Finance_Num, Num_Payments, ACH_CC, Notes, Date FROM CSLogs.dbo.Logs WHERE ForteID = '.$_GET['ForteID'].' ORDER BY Date DESC';

这就像ABCD一样基本,所以我建议你多练习和学习。:)