Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Subquery
Message
De
10/08/2016 02:41:35
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Subquery
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows 7
Network:
Windows XP
Database:
MS SQL Server
Application:
Desktop
Divers
Thread ID:
01639295
Message ID:
01639295
Vues:
78
Dear Experts

I have these code
text TO m.cmd NOSHOW 

SELECT (a.acc_code+b.acc_code)as acc_code,max(acc_name) as acc_name,SUM(qty)as qty,SUM(cr_amount)as cr_amount
from
(select distinct(acc_code) as acc_code ,max(acc_name) as acc_name, qty, cr_amount
	from crsalp a
    where date between ?thisform.text1.value and ?thisform.text2.value
    and substring(acc_code,1,2)='32'  and type='P'
    GROUP BY acc_code
    union all
    select distinct(acc_code) as acc_code ,max(acc_name) as acc_name, qty, cr_amount
    from cashsalp b
    where date between ?thisform.text1.value and ?thisform.text2.value
    and substring(acc_code,1,2)='31'  and type='P'
    GROUP BY acc_code)
    
ENDTEXT
But it has:

Connectivity error: [Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near ')'.

I am trying to get subquery result into main query.
Want sum of qty and cr_amount again group by acc_code

Please help
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform