>SELECT tmpShops.*, shopques.*, ; > IIF(ISNULL(shopextr.extratitle), "", shopextr.extratitle) AS extratitle, ; > IIF(ISNULL(shopextr.extratext), "", shopextr.extratext) AS extratext ; > FROM tmpShops, shopques LEFT OUTER JOIN shopextr ; > ON Shopques.shopquesid = shopextr.shopquesid ; > WHERE (shopques.shopid = tmpShops.shopid) ; > AND (shopques.shopid IN (SELECT shopid ; > FROM tmpShops)) ; > INTO CURSOR tmpExport ; >UNION ; > SELECT tmpShops.*, cursques.*, ; > IIF(ISNULL(cursextr.extratitle), "", cursextr.extratitle) AS extratitle, ; > IIF(ISNULL(cursextr.extratext), "", cursextr.extratext) AS extratext ; > FROM tmpShops, cursques LEFT OUTER JOIN cursextr ; > ON cursques.shopquesid = cursextr.shopquesid ; > WHERE (cursques.shopid = tmpShops.shopid) ; > AND (cursques.shopid IN (SELECT shopid ; > FROM tmpShops)) > >>
CREATE CURSOR myCurs (myMemo M) SELECT... ; IIF(ISNULL(shopextr.extratitle), myCurs.myMemo, shopextr.extratitle) AS extratitleor
SELECT... ; NVL(shopExtr.extraTitle, myCurs.myMemo) AS extraTitle