On 05/08/15 11:58, Tor Jørgen Brekka tor.jor...@kameleongruppen.no
[firebird-support] wrote:
> Here is a part of it like it is today:
> -----------------------------------------------
> BEGIN
>       SELECT PRODUCTIONLINENR FROM TBLPRODUCTIONLINE WHERE ESXKEY = 
> :ESXPRODUCTIONLINE into :PRODUCTIONLINENR;
>     END
> ----------------------------------------------
> 
> If :ESXPRODUCTIONLINE = 'L1' and one record in field ESXKEY = 'L1' then this 
> is no problem.
> 
> But now I want to change the data in ESXKEY so it contains several "L values" 
> in same record separated by semicolon, like this:
> Record 1, ESXKEY = 'L1;L2'
> Record 2, ESXKEY = 'L11;L12'
> Record 3....
> 
> :ESXPRODUCTIONLINE will still have only one "L value" eg 'L1'
> 
> How can I change my SELECT string to get result from record 1 only, if I use 
> LIKE %ESXPRODUCTIONLINE% I will get match in both record 1 and 2 I believe.
> 
> Hope someone can help me.


As Mark mentioned, try to keep your data normalised.

But if this is just for presentation, the following may help:
http://www.developeando.com/2009/02/firebird-21-list-function.html

SELECT LIST(PRODUCTIONLINENR, ';')
  FROM TBLPRODUCTIONLINE
  WHERE ESXKEY = :ESXPRODUCTIONLINE
  GROUP BY ESXKEY
  INTO :PRODUCTIONLINENR;

Although, an irritating problem with the LIST function is that it
doesn't provide any ordering.

Scott

  • [fireb... Tor Jørgen Brekka tor.jor...@kameleongruppen.no [firebird-support]
    • R... Mark Rotteveel m...@lawinegevaar.nl [firebird-support]
    • R... Scott Morgan bl...@blueyonder.co.uk [firebird-support]
      • ... Virna Constantin costel...@yahoo.com [firebird-support]

Reply via email to