Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Very Complex SQL - My Brain Hurts
Message
De
06/07/2006 11:28:25
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01133780
Message ID:
01134176
Vues:
22
OK I'll try it out when I get the chance (if i've read you right). Thanks ever so much as usual.

Terry

>You can join resulting cursor from my select with Op-class on Operator and Class and pull multiplier.
>
>>
>>Sorry, I've been busy on other stuff today. Thanks for the SQL.
>>
>>How to pull "multiplier" from the the Op-class? Well the class code is given to the operators by the ETM manufacturer, in hex form, and is programmed into the ETM. Now one operator may use code XXX to mean "half-day cheap return" whereas another may use it for "county youth card", for instance. Hence, a code isn't unique but can only be compounded with the op # to give an unique key. So it's a matter of:
>>
>>from the ETMDATA rec, getting the class# and op#
>>Using this to find the approp. class on the Op-Class table and thus the multiplier
>>
>>SO how could the getting of that be slotted into your SQL ? :-)
>>
>>(PS Have I told you I love you today? :-)
>>
>>>Hi Terry
>>>
>>>I still don't understand how to pull "multiplier" from the the Op-class table because of multiple records per op# and class#. Anyway, below is a basic query that should get you started. You can calculate totals/%'s in the report itself using the group footers/Report variables.
>>>SELECT Operator, Route, Class, ;
>>>	SUM(IIF(BETWEEN(etmdate, ldStart1, ldEnd1), Notickets, 0000000000)) AS Passengers1, ;
>>>	SUM(IIF(BETWEEN(etmdate, ldStart2, ldEnd2), Notickets, 0000000000)) AS Passengers2 ;
>>>FROM ETMData ;
>>>WHERE etmdate BETWEEN ldStart1 and ldEnd1 OR etmdate BETWEEN ldStart2 and ldEnd2 ;
>>>GROUP BY Operator, Route, Class
>>>
>>>
- Whoever said that women are the weaker sex never tried to wrest the bedclothes off one in the middle of the night
- Worry is the interest you pay, in advance, for a loan that you may never need to take out.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform