在Oracle中合并Group by和order by

时间:2015-10-02 11:21:36

标签: oracle group-by sql-order-by

这就是我所拥有的以及我想要做的事情。 do catch。是一个表,d是一个由大约50个组合表组成的视图:

act

像这样跑步给了我ORA-00936;缺少表达。我对此非常陌生,所以我可能从根本上误解了如何使用SELECT d.extensionaspect1 AS "Exception ID", d.causedat AS "Date", max(act.date_) AS "Causedate", act.prodsteppath AS "Production Step", --I'm calling other selections on d, but i'm not going to incude --them for the sake of clarity FROM pasx.deviationevent d, pasx.vtemp_prodsteppath act --There's more here, but I'm not going to include them for the sake of clarity WHERE act.date_ < d.causedat --as before, there's a large amount of AND clauses here that make --sure that I get the timestamps I want. This is a pretty complex query GROUP BY d.causedat, ORDER BY d.extensionaspect1; 并使用它来查找select max(act.date_)之前发生的时间戳。 d.causedate包含可能导致抛出异常的所有可能时间戳,但只有d.causedat中时间戳之前的时间戳与我相关。

act.date_是一个视图,不包含任何订单或组。如何将这两个表(vtemp_prodsteppathd)组合在一起?我错过了什么表达方式?

0 个答案:

没有答案