我如何解决“在预期的地方找不到 FROM 关键字"?错误 [英] How do I solve the "FROM keyword not found where expected" error

查看:67
本文介绍了我如何解决“在预期的地方找不到 FROM 关键字"?错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

SELECT o.orderid,o.orderdate,
p.productid,o.orderid
o.productstandardprice,
o.productstandardprice*o.ordered_quantity as order_sales_price 
FROM orders_t o and products_t p
WHERE p.productid = o.productid;

我收到错误 ORA-00923: FROM 关键字未在预期的地方找到,我不知道该怎么办

I have been getting the error ORA-00923: FROM keyword not found where expected and I'm not sure what to do

推荐答案

您的问题是 FROM 子句,您应该在其中使用 JOIN:

Your problem is the FROM clause where you should be using JOIN:

SELECT o.orderid, o.orderdate, p.productid, o.orderid, 
       o.productstandardprice,
       (o.productstandardprice * o.ordered_quantity) as order_sales_price 
FROM orders_t o JOIN
     products_t p
     ON p.productid = o.productid;

然而,来自 products_t 的唯一一列是 producctid -- 而它已经在 orders_t 中.我怀疑 JOIN 是否打算用作过滤器,所以这应该是等效的:

However, the only column coming from products_t is producctid -- and that is already in orders_t. I doubt the JOIN is intended as a filter, so this should be equivalent:

SELECT o.orderid, o.orderdate, o.productid, o.orderid, 
       o.productstandardprice,
       (o.productstandardprice * o.ordered_quantity) as order_sales_price 
FROM orders_t o ;

也就是说,这个查询似乎只需要orders_t.

That is, only orders_t seems necessary for this query.

这篇关于我如何解决“在预期的地方找不到 FROM 关键字"?错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆