Search Postgresql Archives

Re: parametered views

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Jun 8, 7:59 pm, "lhaj.mer...@xxxxxxxxx" <lhaj.mer...@xxxxxxxxx>
wrote:
> i have 4 tables :
>
> date_table (date_id,.....)
> A_table(A_table_id, something1,something2.........)
> A1_table(A1_table_id references A_Table(A_Table_id),A11,A12........)
> A2_table(A2_table_id references A_Table(A_table_id),A21,A22,.......)
>
> so i want to create a view with date_id,A_table_id,something1,
> if something2=x then my view containts
>  (A1_table.A11 and A1_table.A12)
>  else it's containts (A2_table.A21 and A2_table.A22))
>
> so my view depends of something2 value.
>
> I hope i'm specific
>
> Thx
> Lhaj

create view foobar as
select date_id,A_table_id,something1
,case when something2=x then A1_table.A11 else A2_table.A21 end as foo
,case when something2=x then A1_table.A12 else A2_table.A22 end as bar
from (... etc., etc. ...)



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux