Thread: SQL Syntax problem
Hello. I've got a problem in porting the following select statement from Oracle to Postgres, because of the characters after "b.bet_id" and "f.ask_id" in the where clause: (+) I don't know what these characters mean and how I can transform these into PostgreSql Syntax. select ... from auswahlkatalog k, anspruchkorrektur a, beteiligter b, v_betkorr f where k.awk_id = a.awk_id and b.bet_id(+) = a.bet_idemp and a.ask_id = f.ask_id(+); Hoping for help. Doris
This kind of conditions are left or right joins, depending on which side of the equal sign you have the (+).<br /><br />Something like this<br /><br /> select ...<br /> from<br /> auswahlkatalog k,<br /> INNER JOIN anspruchkorrektura ON (k.awk_id = a.awk_id),<br /> LEFT JOIN beteiligter b ON (b.bet_id = a.bet_idemp),<br /> RIGHT JOINv_betkorr f ON (a.ask_id = f.ask_id)<br /><br /> should give you the same results.<br /><br /> On Sun, 2003-09-28 at09:43, Doris Bernloehr wrote: <blockquote type="CITE"><pre><font color="#737373"><i>Hello. I've got a problem in porting the following select statement from Oracle to Postgres, because of the characters after "b.bet_id" and "f.ask_id" in the where clause: (+) I don't know what these characters mean and how I can transform these into PostgreSql Syntax. select ... from auswahlkatalog k, anspruchkorrektur a, beteiligter b, v_betkorr f where k.awk_id = a.awk_id and b.bet_id(+) = a.bet_idemp and a.ask_id = f.ask_id(+); Hoping for help. Doris ---------------------------(end of broadcast)--------------------------- TIP 4: Don't 'kill -9' the postmaster </i></font></pre></blockquote>
> I've got a problem in porting the following select statement from Oracle to > Postgres, because of the characters after "b.bet_id" and "f.ask_id" in the > where clause: (+) > I don't know what these characters mean and how I can transform these into > PostgreSql Syntax. > > > select ... > from auswahlkatalog k, anspruchkorrektur a, beteiligter b, v_betkorr f > where k.awk_id = a.awk_id and b.bet_id(+) = a.bet_idemp > and a.ask_id = f.ask_id(+) This (+) means JOIN e.g. (+)-marked equations used as a joining condition To translate it to PGSQL syntax simply remove (+) :-) (only one thing i forgot: isn't it OUTER JOIN?...)
sad wrote: >>select ... >>from auswahlkatalog k, anspruchkorrektur a, beteiligter b, v_betkorr f >>where k.awk_id = a.awk_id and b.bet_id(+) = a.bet_idemp >> and a.ask_id = f.ask_id(+) > > > This (+) means JOIN Means OUTER JOIN but I don't remember the side. > e.g. (+)-marked equations used as a joining condition Not exactly see above Regards Gaetano Mendola
Hi Doris, In oracle (+) is left outer join or right outer join . You need to write: select ... from auswahlkatalog k, beteiligter b left outer join anspruchkorrektur a on(b.bet_id = a.bet_idemp) left outer join v_betkorr f on (a.ask_id = f.ask_id) where k.awk_id = a.awk_id ; regards, ivan. Doris Bernloehr wrote: > Hello. > > I've got a problem in porting the following select statement from Oracle to > Postgres, because of the characters after "b.bet_id" and "f.ask_id" in the > where clause: (+) > I don't know what these characters mean and how I can transform these into > PostgreSql Syntax. > > select ... > from auswahlkatalog k, anspruchkorrektur a, beteiligter b, v_betkorr f > where k.awk_id = a.awk_id and b.bet_id(+) = a.bet_idemp > and a.ask_id = f.ask_id(+); > > Hoping for help. > Doris > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster