Timo Trallala
22-05-2006, 10:05
Habe folgende Abfrage die auch im großen und ganzen das tut, was es soll
SELECT payments.*,r1.ref_text isPayType, r2.ref_text isCCName, pay_ref_type isCust,cust_pay_id isPayID
from payments
LEFT JOIN customer ON (cust_pay_id=pay_id and cust_contact_id='1')
LEFT JOIN refs r1 ON (r1.ref_grp_id=pay_type and r1.ref_grp='pay_type')
LEFT JOIN refs r2 ON (r2.ref_grp_id=pay_type and r2.ref_grp='pay_cc_type' and cust_contact_id='1')
WHERE (pay_type='2' OR pay_type='3' OR pay_ref_id='1')
group by pay_id
order by cust_pay_id DESC
jetzt frag ich mich, wie es funktioniert, das 'isCust' entweder true ist, jenachdem, ob in payments pay_ref_type = CUST ist.
Kann mir da jemand behilflich sein
Danke
der Trallalal
SELECT payments.*,r1.ref_text isPayType, r2.ref_text isCCName, pay_ref_type isCust,cust_pay_id isPayID
from payments
LEFT JOIN customer ON (cust_pay_id=pay_id and cust_contact_id='1')
LEFT JOIN refs r1 ON (r1.ref_grp_id=pay_type and r1.ref_grp='pay_type')
LEFT JOIN refs r2 ON (r2.ref_grp_id=pay_type and r2.ref_grp='pay_cc_type' and cust_contact_id='1')
WHERE (pay_type='2' OR pay_type='3' OR pay_ref_id='1')
group by pay_id
order by cust_pay_id DESC
jetzt frag ich mich, wie es funktioniert, das 'isCust' entweder true ist, jenachdem, ob in payments pay_ref_type = CUST ist.
Kann mir da jemand behilflich sein
Danke
der Trallalal
