[thelist] SQL Statement Problems

Jay Blanchard jay.blanchard at niicommunications.com
Wed Jul 31 10:52:01 CDT 2002


SELECT s.btn, s.custName, t.instPayDate1, t.instPayAmt1, t.instPayStatus1,
t.instPayDate2, t.instPayAmt2,                         	 t.instPayStatus2,
t.instPayDate3, t.instPayAmt3, t.instPayStatus3
FROM tblSubscriber s, tblTracking t
WHERE t.btn = s.btn
AND s.btn = s.wtn
AND s.billStatus <> 'I'
AND t.instPayDate1 IS NOT NULL
AND t.instPayAmt1 > 0.01

This is the current statement, but I need to now further narrow the list
returned, which I can do with PHP. I think that I should be able to do it
with SQL, which is why I ask. This affects the instPayStatus fields;

The following should be included in the return;

1. If instPayStatus1 <> 'paid' no other status exists
2. If instPayStatus1 = 'paid' and there exists a instPayStatus2 <> 'paid'
   no other status exists
3. If instPayStatus1 = 'paid' and there exists a instPayStatus2 = 'paid'
   and there exists a instPayStatus3 <> 'paid'

I was hoping that typing out the thought would bring me to a realization,
but alas I find it does not.

TIA!

Jay

I’ve run out of sick days, so I’m calling in dead

***************************************
*                                     *
* Texas PHP Developers Meeting        *
* Spring 2003                         *
* T Bar M Resort & Conference Center  *
* New Braunfels, Texas                *
* Interested? Contact;                *
* jay.blanchard at niicommunications.com *
*                                     *
***************************************







More information about the thelist mailing list