Hello,
I am new to SQL and need a hand creating a view in Pervasive PSQL v8. The first table called ITEM2 contains a text field which needs to be split apart into 10 separate fields and joined to a table called PROMOCODE. The following select statement is not pretty but works so far for the first two promocodes. The problem is that I cannot use a UNION in a view.
#select item2.plunmbr, promotions.promocode,
promotions.startdate, promotions.enddate
from item2
inner join promotions on
left(item2.promocodes,6) = promotions.promocode
union select item2.plunmbr, promotions.promocode,
promotions.startdate, promotions.enddate
from item2
inner join promotions on
right(left(item2.promocodes,12),6) = promotions.promocode
Many Thanks
I am new to SQL and need a hand creating a view in Pervasive PSQL v8. The first table called ITEM2 contains a text field which needs to be split apart into 10 separate fields and joined to a table called PROMOCODE. The following select statement is not pretty but works so far for the first two promocodes. The problem is that I cannot use a UNION in a view.
#select item2.plunmbr, promotions.promocode,
promotions.startdate, promotions.enddate
from item2
inner join promotions on
left(item2.promocodes,6) = promotions.promocode
union select item2.plunmbr, promotions.promocode,
promotions.startdate, promotions.enddate
from item2
inner join promotions on
right(left(item2.promocodes,12),6) = promotions.promocode
Many Thanks