1
SQL查詢:MySQL的比較列,子查詢
select
usr.username,
(
select usr2.username
from users as usr2
) as another_user
from users as usr
having usr.username != another_user
我怎麼能比較usr.username
與命名爲another_user
例如子查詢?
我想要得到的所有結果,其中usr.username
不等於another_user
我試過WHERE
條款或HAVING
,但仍然得到錯誤
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax
你可以填寫更多的查詢嗎?這些括號之間插入了什麼? –
我只是從同一個表中獲得另一個用戶 – fxuser
忘記sql一分鐘......你究竟想完成什麼?如果你告訴我們,我們可以幫助你更好,因爲你的查詢看起來有點奇怪 - 目前還不清楚你想要做什麼。 – Bohemian