【发布时间】:2010-03-06 11:00:51
【问题描述】:
是否可以进行如下查询:
SELECT
@threadIDvar = `threads`.`id` AS `threadID`,
(SELECT `posts`.`timeDate` FROM `posts` WHERE `posts`.`threadID` = @threadIDvar) AS `postDate`
FROM `threads`
INNER JOIN `posts` ON `posts`.`threadID` = `threads`.`id`
WHERE `threads`.`boardID` = 1
我已经尝试过了,但我得到 @threadID 返回为 NULL,因此 postDate 也为 NULL。
如何让变量@threadIDvar 填充返回的线程ID?
【问题讨论】: