Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: TABLE QUESTION
alex wrote:
> Table question
>
> I have a table with two columns, e.g.:
>
> FORM COUNT SEP
> Xg 2
> Gu 8
> Iu 9
> Vi 1
> Wt 4
>
> I want to run a new query each month and append a new column to the
> table, e.g.:
>
> FORM COUNT SEP COUNT OCT
> Xg 2 6
> Gu 8 9
> Iu 9 2
> Vi 1 6
> Wt 4 7
>
> I know how to alter the table and insert a new column and even data.
> Problem is, however; I don't want to add rows. I want to add the
> counts each month based on the FORM (i.e., where form = form). When I
> run my code, I get the following:
>
> FORM COUNT SEP COUNT OCT
> Xg 2
> Gu 8
> Iu 9
> Vi 1
> Wt 4
> 6
> 9 2
> 6
> 7
>
> Any thoughts?
What you are proposing is a second train wreck: Two in one day. This is the worst possible way to model this in a relational database.
Instead:
FORM MONTH MONTH_COUNT
XG 9 2 XG 10 12 XG 11
And personally I'd add a column for year too.
-- Daniel A. Morgan University of Washington damorgan_at_x.washington.edu (replace x with u to respond) Puget Sound Oracle Users Group www.psoug.orgReceived on Thu Sep 27 2007 - 17:04:15 CDT
![]() |
![]() |