Hi Abhinandan,
I suppose you mean this:
CREATE TABLE nav (
name varchar NOT NULL,
attribute text NOT NULL,
value numeric );
ALTER TABLE ONLY nav ADD CONSTRAINT nav_pkey PRIMARY KEY (name, attribute);
insert into nav values ('James','Weight',70);
insert into nav values ('James','Height',165);
ins
gt; Best,
> Oliver
>
> - Original Message - From: "Scott Swank"
> To: "Oliveiros d'Azevedo Cristina"
> Cc: "Abhinandan Raghavan" ;
>
> Sent: Tuesday, December 06, 2011 5:17 PM
> Subject: Re: [SQL] Self-Join
>
>
>
> H
I have not.
I've already skimmed through it.
Indeed, it is very interesting
Thanx , Scott
Best,
Oliver
- Original Message -
From: "Scott Swank"
To: "Oliveiros d'Azevedo Cristina"
Cc: "Abhinandan Raghavan" ;
Sent: Tuesday, December 06, 2
Have you read Tony Andrew's 2004 piece on this approach? It is a classic.
http://tonyandrews.blogspot.com/2004/10/otlt-and-eav-two-big-design-mistakes.html
Scott
On Tue, Dec 6, 2011 at 6:39 AM, Oliveiros d'Azevedo Cristina
wrote:
> Howdy, Abhinandan,
>
> A quick and dirty solution might be this
Howdy, Abhinandan,
A quick and dirty solution might be this :
SELECT *
FROM
(
SELECT a.name,MAX(b.value) as height
FROM original a
LEFT JOIN original b
ON a.name = b.name
AND b.attribute = 'Height'
GROUP BY a.name
) height
NATURAL JOIN
(
SELECT a.name,MAX(b.value) as weigth
FROM original a
LEFT
Hi Abhinandan,
it's just the same outer join you'd do in Oracle, see:
http://www.postgresql.org/docs/9.1/static/tutorial-join.html
Bèrto
On 6 December 2011 16:57, Abhinandan Raghavan
wrote:
> Hi,
>
> I'm looking to frame an SQL statement in Postgres for what's explained in
> the attached imag
On 2011-05-16, Steve Crawford wrote:
> On 05/14/2011 07:36 PM, Jasen Betts wrote:
>>
>> use the "NOT IN" operator with a subquery to retch the disallowed
>> values
> Hmmm, "retch" as a synonym for "output"? I've seen more than one case
> where that is an appropriate description. :)
:) was
On 05/14/2011 07:36 PM, Jasen Betts wrote:
use the "NOT IN" operator with a subquery to retch the disallowed
values
Hmmm, "retch" as a synonym for "output"? I've seen more than one case
where that is an appropriate description. :)
Cheers,
Steve
--
Sent via pgsql-sql mailing list (pgsql-
In article ,
Jasen Betts writes:
> On 2011-05-14, Seb wrote:
>> Hi,
>>
>> This probably reflects my confusion with how self joins work.
>>
>> Suppose we have this table:
>> If I want to get a table with records where none of the values in column
>> b are found in column a, I thought this shou
On 2011-05-14, Seb wrote:
> Hi,
>
> This probably reflects my confusion with how self joins work.
>
> Suppose we have this table:
> If I want to get a table with records where none of the values in column
> b are found in column a, I thought this should do it:
use the "NOT IN" operator with a su
On Sun, 15 May 2011 07:39:06 +0900,
Ian Lawrence Barwick wrote:
[...]
> Your query doesn't have an explicit join and is producing a cartesian
> result.
> I don't think a self- join will work here; a subquery should produce
> the result you're after:
> SELECT * FROM tmp t1 WHERE NOT EXISTS(SELE
Hi
2011/5/15 Seb :
> Hi,
>
> This probably reflects my confusion with how self joins work.
>
> Suppose we have this table:
>
> =# SELECT * FROM tmp;
> a | b
> ---+---
> 1 | 2
> 2 | 3
> 4 | 5
> (3 rows)
>
> If I want to get a table with records where none of the values in column
> b are found i
12 matches
Mail list logo