convert access sql to postgresql - Mailing list pgsql-general

From Tom Hart
Subject convert access sql to postgresql
Date
Msg-id 473E056A.7020806@coopfed.org
Whole thread Raw
Responses Re: convert access sql to postgresql  (Peter Eisentraut <peter_e@gmx.net>)
Re: convert access sql to postgresql  (Shane Ambler <pgsql@Sheeky.Biz>)
List pgsql-general
Hey guys. I have a long piece of sql that I'm trying to take out of an
existing Access db and modify to work with Postgresql. I've started
trying to convert it, but I've come across a problem that I don't even
know how to describe, let alone google. Here's the function

INSERT INTO MemberMailingAddress (
mb_cn_num,
mb_acct_num,
isactive,
ismember,
ismail,
ispromomail,
... <trimmed for your convenience> ...

)
SELECT
mb_cn_num,
mb_acct_num,
mb_stat_cd<>1 as isactive,
mb_stat_cd=0 as ismember,
isactive and (mb_mail_cd=0 or mb_mail_cd=1) as ismail,
ismail and (mb_stat_cd=0 or mb_stat_cd=2) as ispromomail,
... <trimmed for your convenience> ...

FROM member
ORDER BY mb_cn_num, mb_acct_num
;

Specifically I'm looking at these two lines

isactive and (mb_mail_cd=0 or mb_mail_cd=1) as ismail,
ismail and (mb_stat_cd=0 or mb_stat_cd=2) as ispromomail,

which appear to use other fields it's preparing to insert as variables
in the determination of the values of other fields (I told you I
couldn't figure out how to explain it).

Does anybody have any idea what I'm talking about? I sure don't.

Thomas R. Hart II
tomhart@coopfed.org

pgsql-general by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: [pgtranslation-translators] Call for translations
Next
From: Andrew Sullivan
Date:
Subject: Re: view management