pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oliveiros d'Azevedo Cristina <oliveiros.cristina@marktest.pt>
To: ced <cedric@dreamgnu.com>
To: pgsql-sql@postgresql.org
Subject: Re: Outer join construction step :strange results
Date: Mon, 28 Jun 2010 12:10:47 +0100
Message-ID: <72B95859322043DF995F2012194B4754@marktestcr.marktest.pt> (raw)
References: <4C28736E.8030409@dreamgnu.com>

Howdy, Cedric .

Before analysing this problem of yours further, I 'd like you to kindly 
clarify me some points, please



>
> I have table following tables  T0,T1,T2,T3, T1T2
> with
> -T0(id, fk_T1)
> -T1(id )
> -T2(id, fk_T3)
> -T1T2(fk_T1,fk_T2)
> -T3 (id)
>
> The table T0 represents sets of T1 items.
> The table T1 represents items.
> The table T3 represents property types.
> The table T2 represents represents property values of a specific type.
>


T0.id is not a primary key, is it?

> For every T1 item of a T0 set I want to know if they do or do not have
> T3 property types and if their values.
>

>
> next comes view2 as
>
> create view view2 as
> select T2.fk_T3 as my_id
> from T2,T1T2
> where 1=1
> and T1T2.fk_T1=23456
> and T1T2.fk_T2=T2.id;
>
> This will give me all properties types that the T1 item with id 23456 has.
> let say this query gives me 4 rows.
>


 T1T2 is an associative table between items and their property values, not 
types, is this correct?
If so, I am not realizing why you say that this second view will give you 
all property types. Didn't you mean property values?

 Also, I am not reaching the point of the "1=1" thing. What is the propose 
of it, exactly?
Isnt that condition always truth ? Maybe I am lacking some sql knowledge ...

Thanks in advance for advising me

Best,
Oliveiros




view thread (7+ messages)  latest in thread

Message-ID: <72B95859322043DF995F2012194B4754@marktestcr.marktest.pt>
Permalink:  ../72B95859322043DF995F2012194B4754@marktestcr.marktest.pt/
Also on:    postgresql.org/message-id/72B95859322043DF995F2012194B4754@marktestcr.marktest.pt

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: oliveiros.cristina@marktest.pt, cedric@dreamgnu.com
  Subject: Re: Outer join construction step :strange results
  In-Reply-To: <72B95859322043DF995F2012194B4754@marktestcr.marktest.pt>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox