Re: [SQL] Table alias in DELETE statements

2002-09-13 Thread Manfred Koizar
On Fri, 13 Sep 2002 14:10:25 +0200, Hanno Wiegard <[EMAIL PROTECTED]> wrote: >So the question for me is whether it is possible >to use a table alias in a DELETE statement or not, e.g. >DELETE FROM foo f WHERE f.ID > 3000 (more complicated cases in reality Hanno, looks like you are out of luck h

Re: [SQL] sql group by statement

2002-09-13 Thread Manfred Koizar
On Fri, 13 Sep 2002 12:29:21 +0200, "Albrecht Berger" <[EMAIL PROTECTED]> wrote: >Table : >pk id val1 val2 > 112 3 > 212 4 > 321 1 > 410 5 > 521 8 > > >Needed Result : >pk id val1 val2 > 410 5 > 521 8 Albrecht, "DISTI

[SQL] Table alias in DELETE statements

2002-09-13 Thread Hanno Wiegard
Hi, I've already checked the mailing archive but found nothing about problems with the DELETE statement and table alias but it's not mentioned in the docs. So the question for me is whether it is possible to use a table alias in a DELETE statement or not, e.g. DELETE FROM foo f WHERE f.ID > 3000

[SQL] Assignments in PL/pgSQL

2002-09-13 Thread Michael Paesold
Hi all, although this is not really SQL, but PL/pgSQL, I hope this is the right place to ask. I have written a complex triggers. It works very well. Just now I have realized that I have used the = operater for variable assignments, instead of the := operater. To my suprise, there was no error or

Re: [SQL] sql group by statement

2002-09-13 Thread Albrecht Berger
but how do I know that "distinct on" doesn't cut off the row with max(val2) of that id that I need ? > see the yesterday's thread about DISTINCT ON (non-standard Postgres feature) > > > I have a problem, which I'm not able to solve with a simple query : > > > > I need a resultset with distinct i

Re: [SQL] sql group by statement

2002-09-13 Thread dima
see the yesterday's thread about DISTINCT ON (non-standard Postgres feature) > I have a problem, which I'm not able to solve with a simple query : > > I need a resultset with distinct id's, but the max val2 of each id. > I tried to group by id, but though I need the pk in my resultset > I have t

[SQL] sql group by statement

2002-09-13 Thread Albrecht Berger
Hello, I have a problem, which I'm not able to solve with a simple query : I need a resultset with distinct id's, but the max val2 of each id. I tried to group by id, but though I need the pk in my resultset I have to group it too, which "destroys" the group of val2. Can this be done without a h