I recently asked in postgreSQL. The answer is well fitted, but as soon as I add an add element I, I get the following error:
Error: The table with the unused entry entry "N" in the recommended range (with selection n.pordnr, pz.pordnrzu, n.abschl, n.stg, n.kzfa, pord n Where pz.pordnr = n.pordnr join Left pordnrzu PZ n.pordnr = 112 UNION select all Do n.pversion of n. join pordnr, pz2.pordnrzu, n.abschl, n.stg, n.kzfa, a series of combinations based on the Left n.pversion pordnrzu PZ2 pz2.pordnr = n.pordnr insider At pord n (c.pordnrzu = n.pordnr) WHERE c.abschl IS is NULL) SELECT * FROM CLOCK C WHERE c.abschl IS NOT NULL
I tried several modifications But I can not get to do this work. What I want to do is that the pordnrzu
is being applied to another pordnr
.
It: pordnr
-> Porndnujh
-> pordnr
What I do Also miss?
This sample table is:
Create Table Pord (Pioneer Integer Primary Key, Babes Text, Steg Text, KGFA Text, Persian Text); Putting pord (pordnr, abschl, STG, kzfa, pversion) values (112, zero, zero, zero, zero), (140, zero, zero, zero, zero), (200, zero, zero, zero, zero) , (210, 'F2', '140', 'H', '2011'), (220, 'F2222', '140000', 'HHH', '201111'); Make Tableennerzu (Pioneer Integer Primary Key, Powdenruzu integer); Insert Pordnuzzu (Pordnr, Pordnuzzu) value (112, 140), (140, 210), (200, 220), (210, 220), (220, null);
And so far my query:
with as recommended series (SELECT n.pordnr, pz.pordnrzu, n.abschl, n stg, n.kzfa, pord n Where pz.pordnr = n.pordnr on pordnrzu PZ join Left n.pordnr = 112 UNION select all n.pordnr, pz2.pordnrzu, n.abschl, n.stg, the n.kzfa include n.pversion, the series C Left n.pversion pz2.pordnr on pordnrzu PZ2 are on = n.pordnr insider Join pord n (c.pordnrzu = n.pordnr) Where c.abschl zero ) Choose from * Series C ou c.abschl is not null;
My goal is that I pordnr = 112 'd start with the code>, then
pordnrzu
other pordnr < > / is the code until it
abschl not null
finds the first entry with
, in this example, the solution will be the line:
< Code> pordnr pordnrzu abschl stg Kzfa pversion 200 210 f2 140 H 2011
select version ();
x86_64-unknown-linux-gnu at PostgreSQL 9.2.6, GCC (SUSE Linux) 4.3.4 [GCC-4_3-branch modification 152973], 64-bit
Join
section has been evaluated
. To make this work, proceed to take part in the second part:with as mandatory series (SELECT n.pordnr, pz.pordnrzu, n.abschl, n.stg, n .kzfa, n.pversion join fROM pord n Left pordnrzu PZ pz.pordnr = n.pordnr Where n.pordnr = 112 UNION select all n.pordnr, pz.pordnrzu, n.abschl, n.stg, n.kzfa, series C n.pversion Join the Pord n oN n.pordnr = c.pordnrzu LEFT JOIN pordnrzu pz oN pz.pordnr = n.pordnr WHERE c.abschl IS nULL) SELECT * fROM CLOCK C WHERE C.abschl is not; Alternatively, you can rewrite 1 join in 2 seconds:
LEFT JOIN pordnrzu pz ON pz.pordnr = C.pordnrzu
Comments
Post a Comment