Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
A complex query
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows 7
Network:
Windows XP
Database:
MS SQL Server
Application:
Desktop
Divers
Thread ID:
01643947
Message ID:
01643949
Vues:
49
Program Error
Cancel
Suspend
Ignore
Help
SQL: Error correlating fields.




>Hi Tariq,
>
>
>SELECT codes, amount, (SELECT SUM(AB.amount) FROM table1 AB WHERE LEFT(AB.codes,LEN(AA.codes))=AA.codes) 
>  from table1 AA
>
>
>The simply query is studying in the first hours on SELECT-SQL session.
>
>
>MartinaJ
>
>>Dear Experts
>>
>>I have these codes
>>
>>
>>CREATE CURSOR table1 (codes c(7),names c(10),amount n(4))
>>INSERT INTO table1 VALUES ('1','',0)
>>INSERT INTO table1 VALUES ('11','',0)
>>INSERT INTO table1 VALUES ('1101','',0)
>>INSERT INTO table1 VALUES ('1101001','',200)
>>INSERT INTO table1 VALUES ('1101002','',600)
>>INSERT INTO table1 VALUES ('1101005','',700)
>>INSERT INTO table1 VALUES ('1102','',0)
>>INSERT INTO table1 VALUES ('1102001','',100)
>>INSERT INTO table1 VALUES ('1102003','',400)
>>INSERT INTO table1 VALUES ('12','',0)
>>INSERT INTO table1 VALUES ('1201','',0)
>>INSERT INTO table1 VALUES ('1201001','',800)
>>INSERT INTO table1 VALUES ('1201003','',300)
>>
>>
>>
>>I need result shown in image
>>
>>Please
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform