Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Monthwise data
Message
De
07/10/2016 08:31:26
Thomas Ganss (En ligne)
Main Trend
Frankfurt, Allemagne
 
 
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:
01641727
Message ID:
01641738
Vues:
37
would union all not be better ? Or at least a "fromview" column?

>>Dear Experts
>>
>>I have this query
>>
>>
>>  SELECT distinct(data1.month)as month, SUM(data1.qty)as qty,SUM(data1.weight)as weight,SUM(data1.dr_amount)as dr_amount
>>from(
>>select MONTH(DATE) as month,SUM(qty)as qty,SUM(qty*weight)as weight,SUM(cr_amount) as dr_amount
>> from vcashsalp
>> where type='P'
>> group by month(date)
>>    union
>> select MONTH(DATE) as month,SUM(qty)as qty,SUM(qty*weight)as weight,SUM(cr_amount) as dr_amount
>> from vcrsalp
>> where type='P'
>> group by month(date)
>> )
>>     as data1
>>
>>
>>It says:
>>
>>Msg 8120, Level 16, State 1, Line 1
>>Column 'data1.month' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
>>
>>
>>I am trying to get Monthwise sale.
>>
>>vcashsalp and vcrsalp are views.
>>
>>Please help
>
>Try
>
>
>SELECT data1.month as month, SUM(data1.qty)as qty,SUM(data1.weight)as weight,SUM(data1.dr_amount)as dr_amount
>from(
>select MONTH(DATE) as month,SUM(qty)as qty,SUM(qty*weight)as weight,SUM(cr_amount) as dr_amount
> from vcashsalp
> where type='P'
> group by month(date)
>    union
> select MONTH(DATE) as month,SUM(qty)as qty,SUM(qty*weight)as weight,SUM(cr_amount) as dr_amount
> from vcrsalp
> where type='P'
> group by month(date)
> )
>     as data1
>
>GROUP BY Month
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform