Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/250.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 我想要最大id所在的行_Php_Max - Fatal编程技术网

Php 我想要最大id所在的行

Php 我想要最大id所在的行,php,max,Php,Max,我的问题 select max(forum_id) as f_id from forum where topic_id='$fo_id'; 我们想要论坛id最大的所有行记录。我的问题如上所述。我们成功地获得了最大论坛id,但我们希望整行的最大论坛id。您能帮我吗?试试这个: SELECT * FROM forum WHERE topic_id='$fo_id' ORDER BY forum_id DESC LIMIT 0, 1; 试试这个: SELECT * FROM forum WHERE

我的问题

select max(forum_id) as f_id from forum where topic_id='$fo_id';
我们想要论坛id最大的所有行记录。我的问题如上所述。我们成功地获得了最大论坛id,但我们希望整行的最大论坛id。您能帮我吗?

试试这个:

SELECT * FROM forum WHERE topic_id='$fo_id' ORDER BY forum_id DESC LIMIT 0, 1;
试试这个:

SELECT * FROM forum WHERE topic_id='$fo_id' ORDER BY forum_id DESC LIMIT 0, 1;
试试这个:

SELECT * FROM forum WHERE topic_id='$fo_id' ORDER BY forum_id DESC LIMIT 0, 1;
试试这个:

SELECT * FROM forum WHERE topic_id='$fo_id' ORDER BY forum_id DESC LIMIT 0, 1;

您可以在下面给定的查询中尝试

 SELECT * from tabName where `tabId` IN (select MAX(tabId) from tabName);

您可以在下面给定的查询中尝试

 SELECT * from tabName where `tabId` IN (select MAX(tabId) from tabName);

您可以在下面给定的查询中尝试

 SELECT * from tabName where `tabId` IN (select MAX(tabId) from tabName);

您可以在下面给定的查询中尝试

 SELECT * from tabName where `tabId` IN (select MAX(tabId) from tabName);
你可以试试

select * from forum where topic_id='$fo_id' order by forum_id desc
我想它会起作用的

你可以试试

select * from forum where topic_id='$fo_id' order by forum_id desc
我想它会起作用的

你可以试试

select * from forum where topic_id='$fo_id' order by forum_id desc
我想它会起作用的

你可以试试

select * from forum where topic_id='$fo_id' order by forum_id desc

我想它会起作用的

如果需要count alias,则还可以将查询写入select*,tabId写入来自tabName的CNT,其中tabId在select MAXtabId from tabName中如果需要count alias,则还可以将查询写入select*,tabId作为来自tabName的CNT,其中tabId在从tabName中选择MAXtabId如果您想要计数别名,那么您也可以将查询作为select*写入,tabId作为来自tabName的CNT,tabId作为来自tabName的CNT在从tabName中选择MAXtabId如果您想要计数别名,那么您也可以将查询作为select*写入,tabId作为来自tabName的CNT,其中tabId位于从tabName选择MAXtabId