Subject Re: [firebird-support] Add column for duplicates
Author Alan.Davies@aldis-systems.co.uk
Well, yes this is an "odd" idea. You are making life difficult for
yourself in future.
If you only ever have occ1,occ2,occ3 then you could do this but you
would regard each record as distinct from every other record and
presumably would want three fields returned with every query - whether
they were populated or not?
What happens when someone wants another - occ4 - in 6 months. You have
to redesign your system. Bad idea.
What if there are empty fields - do you want to check on nulls or
populate them with "" as a default?

You can do what you want already with a query such as:
select field2 from yourtable where ID=:yourvalue and field1=:yourfield
This returns:
val1
val6
val15
You can insert :yourtable and :yourfield into your system yourself,
either from a stored procedure or as a variable from say Delphi or VB
The formatting of the selected data is completely up to you.

--
Alan J Davies


Quoting Serge Fonville <serge.fonville@...>:

> Hi,
>
> Currently I am developing a system which import data from a Interbase
> Database and I have an 'odd' idea about something and would like some
> opinions and advice with it
>
> I have a table as follows:
> ID,field1,field2
> 1,a,val1
> 2,a,val6
> 3,a,val15
> 4,b,val9
> 5,b,val11
> 6,b,val4
> 7,c,val21
> 8,d,val3
> 9,e,val17
>
> What I need is a table as follows
>
> ID,field1,occ1,occ2,occ3
> 1,a,val1,val6,val15
> 2,b,val9,val11,val4
>
> Is this at all possible or do i need to approach this entirely different?
>
> Thanks in advance,
>
> Serge Fonville
>
>
> [Non-text portions of this message have been removed]
>
>