Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL error
Message
De
23/04/2015 00:51:45
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Allemagne
 
 
À
22/04/2015 20:18:17
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01618877
Message ID:
01618993
Vues:
52
>Created new tables from scratch, entered 100 records. Indexed. Still same problem. The where in the subselect is returning dredeemdat fields that it should not.
>
>>>redeem.dredeemdat is never null, although it can be empty.
>>>
>>There is absolutely no reason then for the SELECTs behave differently. I would check all involved tables and indexes for corruption.

Try:
SELECT;
 Cur1.ccompany,;
 Cur1.custcode,;
 COUNT(Cur1.req_date) AS nTotal,;
 SUM(Cur1.nstorage) AS nstorage,;
 SUM(Cur1.tow_chrg) AS nTows;
 FROM (;
 SELECT;
 Cur1_1.ccompany,;
 Cur1_1.custcode,;
 Cur1_2.req_date,;
 Cur1_2.nstorage,;
 Cur1_2.tow_chrg;
 FROM a AS Cur1_1;
 INNER JOIN b AS Cur1_2;
 ON Cur1_2.custcode=Cur1_1.custcode;
 WHERE Cur1_1.control_no IN (;
 SELECT;
 Cur1__1.towfky FROM redeem AS Cur1__1;
 WHERE Cur1__1.dredeemdat b>= {01/01/2014} AND Cur1__1.dredeemdat<= {12/31/2014};
 );
 ) AS Cur1;
 INTO CURSOR temp1 READWRITE;
 GROUP BY 1,2;
 ORDER BY 1,2
not tested, no data


It first sorts out the records and then group/order. Your version do the other way around

Lutz
Words are given to man to enable him to conceal his true feelings.
Charles Maurice de Talleyrand-Périgord

Weeks of programming can save you hours of planning.

Off

There is no place like [::1]
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform