仅从数据表中选择具有一定数量的行。

时间:2022-05-09 15:40:08

So... Probably my title is missleading but...

所以…也许我的标题是误导,但是……

What my code currently does..

我的代码现在做的是…

SELECT TOP 12
    *,
    r.user_name
FROM
    something p
INNER JOIN users r ON p.fk_user_id = r.user_id
ORDER BY
    something_id DESC

It pretty much only takes things from bottom and sorting it by id... But what I need additionally is somehow add WHERE something_season = number and select only those things with fixed number, not everything.

它基本上只从底部取东西,然后用id来排序…但是我还需要添加的是something_season = number并且只选择那些具有固定数值的东西,而不是所有的东西。

Any suggestion? I guess that I can't even put WHERE in there.

任何建议吗?我想我甚至都放不进去。

1 个解决方案

#1


3  

You can put where as following:

你可在下列地方放置:

SELECT TOP 12 *,r.user_name
FROM something p
INNER JOIN users r ON p.fk_user_id = r.user_id
WHERE something_season = number
ORDER BY something_id DESC

#1


3  

You can put where as following:

你可在下列地方放置:

SELECT TOP 12 *,r.user_name
FROM something p
INNER JOIN users r ON p.fk_user_id = r.user_id
WHERE something_season = number
ORDER BY something_id DESC