Am 12.02.2014 12:01, schrieb Ritchie P. Fraser:
> Hi Phil,
>
> I don't think you were at all rude. In fact, you were consise and provided just the answer I was looking for, and I thank you :-)
>
> I had in the mean time been playing with....
> condition = ${lookup pgsql{SELECT name FROM maildomains WHERE name='$domain' AND status='t';}{yes}{no}}
> ...which, if a single match is returned from the database evaluates to true/yes and if no rows returned is evaluated to false/no.
>
if you can get it too work that way, think different : let the database
do your job
condition = ${if eq{1}{${lookup pgsql{SELECT '1' FROM maildomains WHERE name='${quote_mysql:${domain}}' AND status='t' LIMIT 1;}}}{yes}{no}}
Does the following ...
A= selects '1' ( for true ) IF name = $domain
IF $A == 1 return yes
All you need to change is the ${domain} variable, put there what you need to check it against.
You can even have RegExpression in your SQL if pgsql supports it, which is a mighty weapon :)
best regards,
Marius