When trying to delete data from a table, get the following error:
ExecutePlan: (junk) `ctid' is NULL!=ODBC.QueryDef
Please advice.
---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?
http://www.postgresql.org/users-lounge/docs/faq
Alex,
> which is the highest value of 'sortby' for each value of 'fk'.
>
> I would think that the SQL to achieve this is:
>
> SELECT * FROM test GROUP BY fk HAVING sortby = MAX(sortby);
You need a subselect for this:
SELECT test.*
FROM test, (SELECT max(sortby) as maxsort, fk
On Wed, 8 Aug 2001, Cedar Cox wrote:
>
> Two questions (maybe they are silly..)
>
> 1. Can a column reference more than one table? (This assumes you use a
> single sequence to generate the IDs for both "tbla" and "tblb". I guess
> you would also have the problem of enforcing a unique index.
Josh Berkus wrote:
> Cedar,
>
> > 1. Can a column reference more than one table? (This assumes you use
> > a
> > single sequence to generate the IDs for both "tbla" and "tblb". I
> > guess
> > you would also have the problem of enforcing a unique index. Say
> > what?!
> > A unique index across
May be, in a far future, will be better to have a stored procedures which
will able to accept input arguments and output arguments?
Aug 8, 09:26 -0700, Josh Berkus wrote:
> Chris,
>
> > The called function (test2() in the example) will MODIFY the two
> > arguments
> > and then return a true val
"Alex Page" <[EMAIL PROTECTED]> writes:
> I'm trying to write a query that returns the rows containing the
> most recent values for each foreign key.
The best way to do this (on every dimension except portability :-()
is SELECT DISTINCT ON. See the weather-report example in the SELECT
reference
As for me it is looking as not good normalized structure.
After normalization should not be any questions, I think...
Aug 8, 19:02 +0300, Cedar Cox wrote:
>
> Two questions (maybe they are silly..)
>
> 1. Can a column reference more than one table? (This assumes you use a
> single sequence to g
Cedar,
(sorry for the double posting, folks)
> 2. Can a column reference another column in the same table? eg..
>
> CREATE TABLE bloo (
> id int4,
> p_id int4 REFERENCES bloo (id)
> -- or
> --p_id int4 REFERENCES (id)
> )
You don't do this with REFERENCES ... you do it with a
Chris,
> The called function (test2() in the example) will MODIFY the two
> arguments
> and then return a true value. After test2() has run, the value of the
> two
> arguments 'has changed' to what test2() has assigned to them.
I understand, now. You're trying to replicate the functionality
pro
I'm having real trouble with aggregate functions. I have a table which
tracks the value of a field in another table over time - it contains a
foreign key to the row in the other table, the value, and a timestamp to
sort by. I'm trying to write a query that returns the rows containing the
most rece
Cedar,
> 1. Can a column reference more than one table? (This assumes you use
> a
> single sequence to generate the IDs for both "tbla" and "tblb". I
> guess
> you would also have the problem of enforcing a unique index. Say
> what?!
> A unique index across multiple tables.. absurd :) eg..
I suggest the best place to put your tests is in the WHERE clause. They are
out of place in the JOIN clauses, even though this (apparently) works as you
expect, because they do not represent a joining of fields. Also, easier to
read and understand in the WHERE clause.
On joins in general: there
Two questions (maybe they are silly..)
1. Can a column reference more than one table? (This assumes you use a
single sequence to generate the IDs for both "tbla" and "tblb". I guess
you would also have the problem of enforcing a unique index. Say what?!
A unique index across multiple tables
Josh,
the two functions are just a tiny example of what I want to do which is:
call a function with 2 or more arguments (v_val1 and v_val2).
The called function (test2() in the example) will MODIFY the two arguments
and then return a true value. After test2() has run, the value of the two
argume
Jeff Eckermann wrote:
>
> The WHERE clause is evaluated before your SELECT list is determined, so the
> aliased value cannot be used.
> You can put further NOT NULL tests into the subqueries to make sure that
> null values are not returned.
> Question: why not just join the tables explicitly?
:-
The WHERE clause is evaluated before your SELECT list is determined, so the
aliased value cannot be used.
You can put further NOT NULL tests into the subqueries to make sure that
null values are not returned.
Question: why not just join the tables explicitly? The more usual SQL
approach would be
Andreas Joseph Krogh writes:
> Hi, this is my first post to this list so please...
> I have problems getting this query to work, any ideas?
>
> select article.title_text_key,
> (select on_text.text_value from on_text where
> on_text.text_key = title_text_key
> AND NOT title_text_key i
Thomas Good wrote:
>
> On Wed, 8 Aug 2001, Andreas Joseph Krogh wrote:
>
> > Hi, this is my first post to this list so please...
> > I have problems getting this query to work, any ideas?
> >
> > select article.title_text_key,
> > (select on_text.text_value from on_text where
> > on_text.t
On Wed, 8 Aug 2001, Andreas Joseph Krogh wrote:
> Hi, this is my first post to this list so please...
> I have problems getting this query to work, any ideas?
>
> select article.title_text_key,
> (select on_text.text_value from on_text where
> on_text.text_key = title_text_key
> AND
Hi all,
How can I get more than one value back from a function?
I have a situation here, where a function needs to return a value - but also
needs to indicate from which type of record the value comes.
The most elegant would be something like the 2 functions listed below. They
don't work, since
Hi, this is my first post to this list so please...
I have problems getting this query to work, any ideas?
select article.title_text_key,
(select on_text.text_value from on_text where
on_text.text_key = title_text_key
AND NOT title_text_key is NULL
AND on_text.lang_id = (s
Hi all,
On Tuesday 07 August 2001 7:35 pm, Tom Lane wrote:
> Jan Wieck <[EMAIL PROTECTED]> writes:
> > The point is that we based our implementation of foreign keys
> > on the SQL3 specs. DEFERRED is not in SQL-92 AFAIK.
>
> I still have a concern about this --- sure, you can set up the
22 matches
Mail list logo