SQL-AS-表不存在-1146 [英] SQL - AS - table doesn't exist - 1146
本文介绍了SQL-AS-表不存在-1146的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的查询是:
SELECT temp.pid FROM
(SELECT postid, date FROM swapping AS s, post AS p
WHERE s.mid='2' AND p.postid=s.postid) AS temp
WHERE temp.date = (SELECT MAX(date) FROM temp)
我收到#1146-表'databasename.temp'不存在
I receive #1146 - Table 'databasename.temp' doesn't exist
我如何使其起作用? 谢谢.
How can I make it work? Thank you.
推荐答案
似乎您想选择最后一个"pid",以"date"为单位,其中s.mid ='2'
It seems like you want to select the last "pid", in terms of "date", where s.mid='2'
尝试一下(找出pid的来源并更正第一行之后)
Try this (after you figure out where pid comes from and correct the first line)
SELECT [s? or maybe p?].pid
FROM swapping s INNER JOIN post p ON p.postid=s.postid
WHERE s.mid = '2'
ORDER BY date DESC
LIMIT(0,1)
您可能还需要按日期顺序对日期列进行别名.
You might also need to alias the date column in the order by line.
这篇关于SQL-AS-表不存在-1146的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文