“where子句”中的未知列“...”

时间:2018-04-22 17:41:42

标签: mysql sql sqlyog

我遇到了一个特定任务的问题:

SELECT radnik.*, nalog.prioritetNalog FROM radnik
INNER JOIN nalog ON radnik.sifRadnik=nalog.sifRadnik
WHERE kvar.nazivKvar ="Zamjena klipa";

结果:

Error Code: 1054
Unknown column 'kvar.nazivKvar' in 'where clause'

它说明了这一点,但是列和数据表存在

https://i.stack.imgur.com/mQZt4.jpg

3 个答案:

答案 0 :(得分:0)

尝试这种语法:

SELECT column1, column2....columnN
FROM   table_name1 t1, table_name2 t2
on t1.id = t2.id
WHERE  CONDITION;

示例:

SELECT radnik.*, nalog.prioritetNalog 
FROM radni INNER JOIN nalog 
ON radnik.sifRadnik=nalog.sifRadnik
WHERE table_name.column_name ="Zamjena klipa";

答案 1 :(得分:0)

您需要额外的JOIN

SELECT r.*, n.prioritetNalog
FROM radnik r INNER JOIN
     nalog n
     ON r.sifRadnik = n.sifRadnik INNER JOIN
     kvar k
     ON k.sifkvar = n.sifkvar
WHERE k.nazivKvar = 'Zamjena klipa';

您只能引用查询中FROM子句中定义的列。

答案 2 :(得分:0)

我错过了一次加入,感谢您的帮助

Exception in thread "main" java.lang.AssertionError: assertion failed: timeout (3 seconds) during expectMsg while waiting for OnNext(Stream(12, ?))
    at scala.Predef$.assert(Predef.scala:219)
    at akka.testkit.TestKitBase.expectMsg_internal(TestKit.scala:401)
    at akka.testkit.TestKitBase.expectMsg(TestKit.scala:378)
    at akka.testkit.TestKitBase.expectMsg$(TestKit.scala:378)
    at akka.testkit.TestKit.expectMsg(TestKit.scala:890)
    at akka.stream.testkit.TestSubscriber$ManualProbe.expectNext(StreamTestKit.scala:337)
    at com.glassbeam.scalar.lcp.rules.timeseries.SlidingWindowOnTriggerTest2$.delayedEndpoint$com$glassbeam$scalar$lcp$rules$timeseries$SlidingWindowOnTriggerTest2$1(WindowTest.scala:122)
    at com.glassbeam.scalar.lcp.rules.timeseries.SlidingWindowOnTriggerTest2$delayedInit$body.apply(WindowTest.scala:95)
    at scala.Function0.apply$mcV$sp(Function0.scala:34)
    at scala.Function0.apply$mcV$sp$(Function0.scala:34)
    at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
    at scala.App.$anonfun$main$1$adapted(App.scala:76)
    at scala.collection.immutable.List.foreach(List.scala:389)
    at scala.App.main(App.scala:76)
    at scala.App.main$(App.scala:74)
    at com.glassbeam.scalar.lcp.rules.timeseries.SlidingWindowOnTriggerTest2$.main(WindowTest.scala:95)
    at com.glassbeam.scalar.lcp.rules.timeseries.SlidingWindowOnTriggerTest2.main(WindowTest.scala)