On Sat, Sep 29, 2012 at 2:28 PM, Victor Sterpu wrote:
> This is a way to do it, but things will change if you have many
> attributes/object
>
> SELECT o.*, COALESCE(a1.value, a2.value)
> FROM objects AS o
> LEFT JOIN attributes AS a1 ON (a1.object_id = o.id)
> LEFT JOIN attributes AS a2 ON (a2.ob
This is a way to do it, but things will change if you have many
attributes/object
SELECT o.*, COALESCE(a1.value, a2.value)
FROM objects AS o
LEFT JOIN attributes AS a1 ON (a1.object_id = o.id)
LEFT JOIN attributes AS a2 ON (a2.object_id = 0);
On 29.09.2012 19:02, Andreas wrote:
Hi,
asume I've
On Sep 29, 2012, at 12:02, Andreas wrote:
> Hi,
>
> asume I've got 2 tables
>
> objects ( id int, name text )
> attributes ( object_id int, value int )
>
> attributes has a default entry with object_id = 0 and some other where
> another value should be used.
>
> e.g.
> objects
> ( 1, '
On Sat, Sep 29, 2012 at 9:02 AM, Andreas wrote:
> Hi,
>
> asume I've got 2 tables
>
> objects ( id int, name text )
> attributes ( object_id int, value int )
>
> attributes has a default entry with object_id = 0 and some other where
> another value should be used.
>
> e.g.
> objects
> ( 1,
Hi,
asume I've got 2 tables
objects ( id int, name text )
attributes ( object_id int, value int )
attributes has a default entry with object_id = 0 and some other where
another value should be used.
e.g.
objects
( 1, 'A' ),
( 2, 'B' ),
( 3, 'C' )
attributes
( 0, 42
Hello,
thank you. The "WITH" clause did the trick. I did not even know that such a
thing exists. But as it turns out it makes the statement more readable and
elegant but not faster.
The reason for the latter is that both the CTE and the UPDATE statement have
the same "FROM ... WHERE ..." part,
Thomas Kellerer hat am 29. September 2012 um 16:13
geschrieben:
> Matthias Nagel wrote on 29.09.2012 12:49:
> > Hello,
> >
> > is there any way how one can store the result of a time-consuming
> > calculation if this result is needed more
> >than once in an SQL update query? This solution might
Matthias Nagel wrote on 29.09.2012 12:49:
Hello,
is there any way how one can store the result of a time-consuming calculation
if this result is needed more
than once in an SQL update query? This solution might be PostgreSQL specific
and not standard SQL compliant.
Here is an example of what
On Sep 29, 2012, at 6:49, Matthias Nagel wrote:
> Hello,
>
> is there any way how one can store the result of a time-consuming calculation
> if this result is needed more than once in an SQL update query? This solution
> might be PostgreSQL specific and not standard SQL compliant. Here is an
Hello,
> Matthias Nagel hat am 29. September 2012 um 12:49
> geschrieben:
> > Hello,
> >
> > is there any way how one can store the result of a time-consuming
> > calculation
> > if this result is needed more than once in an SQL update query? This
> > solution
> > might be PostgreSQL specific a
Matthias Nagel hat am 29. September 2012 um 12:49
geschrieben:
> Hello,
>
> is there any way how one can store the result of a time-consuming calculation
> if this result is needed more than once in an SQL update query? This solution
> might be PostgreSQL specific and not standard SQL compliant.
Hello,
is there any way how one can store the result of a time-consuming calculation
if this result is needed more than once in an SQL update query? This solution
might be PostgreSQL specific and not standard SQL compliant. Here is an example
of what I want:
UPDATE table1 SET
StartTime = 't
12 matches
Mail list logo