我有问题。我有三个表,名为AUTHORS,BOOKS_AUTHORS和BOOKS,我试图从这三个表中选择Lev Tolstoi写的书。 这就是我现在所拥有的,但它不起作用
select "AUTHORS"."LASTNAME" as "LASTNAME",
"AUTHORS"."FIRSTNAME" as "FIRSTNAME",
"BOOKS"."NAME" as "NAME",
from "BOOKS_AUTHORS",
"BOOKS",
"AUTHORS"
where "AUTHORS"."ID"="BOOKS_AUTHORS"."ID_AUTHOR"
and "BOOKS_AUTHORS"."ID_BOOK"="BOOKS"."ID"
and "AUTHORS"."LASTNAME"="Tolstoi"
and "AUTHORS"."FIRSTNAME"="Lev"
我在这个名为iacademy3.oracle.com的网站上有表格,错误是
" ORA-00936:缺少表达"
答案 0 :(得分:0)
为什么使用旧的$conn = mysqli_connect("localhost", "root","","ATFlogin");
语法,使用正确的显式JOIN
语法使其更具可读性,并在需要时更容易扩展到其他连接。
JOIN
答案 1 :(得分:0)
在这里看起来你有一个额外的逗号:" BOOKS"。" NAME" as" NAME", - 我将其删除
select "AUTHORS"."LASTNAME" as "LASTNAME",
"AUTHORS"."FIRSTNAME" as "FIRSTNAME",
"BOOKS"."NAME" as "NAME"
from "BOOKS_AUTHORS",
"BOOKS",
"AUTHORS"
where "AUTHORS"."ID"="BOOKS_AUTHORS"."ID_AUTHOR"
and "BOOKS_AUTHORS"."ID_BOOK"="BOOKS"."ID"
and "AUTHORS"."LASTNAME"="Tolstoi"
and "AUTHORS"."FIRSTNAME"="Lev"