这个查询有什么问题?

时间:2021-10-30 06:22:19

This query:

SELECT tbl_deliverable.*, user_to_deliverable.*
where tbl_deliverable.id = user_to_deliverable.d_id 

returns this error from phpmyadmin:

从phpmyadmin返回此错误:

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'where tbl_deliverable.id = user_to_deliverable.d_id' at line 1

#1064 - 您的SQL语法有错误;查看与您的MySQL服务器版本对应的手册,以便在第1行的'where tbl_deliverable.id = user_to_deliverable.d_id'附近使用正确的语法

Why?

2 个解决方案

#1


3  

You forgot your "from tables" in the SQL:

您忘记了SQL中的“from tables”:

SELECT tbl_deliverable.*,   user_to_deliverable.*
from   tbl_deliverable,     user_to_deliverable
where  tbl_deliverable.id = user_to_deliverable.d_id

Just add:

from tbl_deliverable, user_to_deliverable

#2


4  

You have no FROM clause.

你没有FROM子句。

It should be

它应该是

SELECT tbl_deliverable.*, user_to_deliverable.* 
FROM tbl_deliverable, user_to_deliverable                -- <== missing
where tbl_deliverable.id = user_to_deliverable.d_id 

or do ANSI SQL-92

或者做ANSI SQL-92

SELECT tbl_deliverable.*, user_to_deliverable.* 
FROM tbl_deliverable INNER JOIN user_to_deliverable               
         ON tbl_deliverable.id = user_to_deliverable.d_id 

#1


3  

You forgot your "from tables" in the SQL:

您忘记了SQL中的“from tables”:

SELECT tbl_deliverable.*,   user_to_deliverable.*
from   tbl_deliverable,     user_to_deliverable
where  tbl_deliverable.id = user_to_deliverable.d_id

Just add:

from tbl_deliverable, user_to_deliverable

#2


4  

You have no FROM clause.

你没有FROM子句。

It should be

它应该是

SELECT tbl_deliverable.*, user_to_deliverable.* 
FROM tbl_deliverable, user_to_deliverable                -- <== missing
where tbl_deliverable.id = user_to_deliverable.d_id 

or do ANSI SQL-92

或者做ANSI SQL-92

SELECT tbl_deliverable.*, user_to_deliverable.* 
FROM tbl_deliverable INNER JOIN user_to_deliverable               
         ON tbl_deliverable.id = user_to_deliverable.d_id