Warnung: file_put_contents(/home/www/web1/html/php_dev/test.txt) [function.file-put-contents]: failed to open stream: Permission denied in /home/www/web1/html/php_dev/sys/lib.activity.php (Zeile 58)
[MySQL 4.1] Abfrage-Frage [Archiv] - PHP-Scripte PHP-Tutorials PHP-Jobs und vieles mehr

- Ad -
php-resource




Archiv verlassen und diese Seite im Standarddesign anzeigen :
[MySQL 4.1] Abfrage-Frage


 
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

 
mrhappiness
22-05-2006, 11:02 
 
SELECT (payments.pay_ref_type = CUST) iscust

in iscust steht jetzt eine 1 oder eine 0

 
Timo Trallala
22-05-2006, 11:26 
 
Danke, das war ja simple


Alle Zeitangaben in WEZ +2. Es ist jetzt 17:55 Uhr.