我想用另一个表中的值更新表,这些表并不总是存在。所以我需要离开加入另一张桌子。我找到的唯一方法是:
Wanted but not invoked:
recordWriter.writeRecordToFile(
[50, 48, 49, 54, 48, 51, 49, 56, 45, 49, 50, 49, 52, 49, 51, 44, 50, 48, 49, 54, 48, 51, 49, 56, 49, 49, 50, 50, 44, 50, 48, 49, 54, 48, 51, 49, 56, 49, 49, 50, 57, 44, 51, 51, 51, 54, 53, 52, 56, 55, 57, 56, 44, 112, 114, 111, 118, 97, 44, 104, 101, 108, 108, 111, 44, 105, 32, 100, 111, 110, 39, 116, 32, 107, 110, 111, 119, 10]
);
-> at report.RecordWriterTest.setup(RecordWriterTest.java:72)
Actually, there were zero interactions with this mock.
at report.RecordWriterTest.setup(RecordWriterTest.java:72)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
我的问题:是否可以左键加入另一个表,而不再在内部加入(在哪里)更新表?
答案 0 :(得分:1)
是的,但没有使用明确的join
。在您的情况下,这是足够的,因为a
只有一行:
UPDATE lessonentity le
SET title = a.test
FROM (SELECT 'hoho1' test) a
WHERE le.lessonid = 48552;
通常,WHERE
中会有一个附加条件,连接a
和le
,但在这种情况下这不是必需的,因为该表只有一行。