Home >Backend Development >PHP Tutorial > 求一句SQL话语

求一句SQL话语

WBOY
WBOYOriginal
2016-06-13 13:25:02865browse

求一句SQL语句!
现在有一个video表,里面有id,title,type,time等列名,现要根据time排序选出每种type的前10个记录,SQL语句如何写呢?

------解决方案--------------------

探讨

他要按time排序选,而且应该是倒序(虽然他没说),所以我猜是

SELECT *
FROM video t
WHERE 10 > (
SELECT COUNT( * )
FROM video
WHERE type=t.type
AND time>t.ti……
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn