Pagina 2 di 2 primaprima 1 2
Visualizzazione dei risultati da 11 a 13 su 13
  1. #11
    Ciao,
    non ho creato io la tabella e non posso toccarla..
    Ho ripristinato il Group by e l'ultima versione della query è questa.
    codice:
     
    select  datepart(mm,CONVERT(date,DATF,105)) as mese,  datename(month,CONVERT(date,DATF,105)) as miadata,SUM(CAST(NETTO AS INT))  AS quanti from MOVIMENTI where  (CAUS IN ('01', '02','65')) AND (MOVIMENTI.SMAL = '900000.0002')group by  DATEname (month,convert(date,datf,105))  order by datepart(mm,CONVERT(date,DATF,105))
    Questo è l'errore che ottengo
    Column 'MOVIMENTI.DATF' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.

    Grazie cmq

  2. #12
    mettiamo un po' d'ordine...

    codice:
    select  
       datepart(mm,CONVERT(date,DATF,105)) as mese,  
       datename(month,CONVERT(date,DATF,105)) as miadata,
       SUM(CAST(NETTO AS INT)) AS quanti 
    from 
       MOVIMENTI 
    where  
       (CAUS IN ('01', '02','65')) 
       AND (MOVIMENTI.SMAL = '900000.0002')
    group by  
       datepart(mm,CONVERT(date,DATF,105))
    order by 
       datepart(mm,CONVERT(date,DATF,105))

  3. #13
    Ciao,
    grazie alla fine questa sotto è quella funzionante se a qualcuno serve come spunto..


    codice:
    select distinct
       datepart(mm,CONVERT(date,DATF,105)) as mese,  
       datename(month,CONVERT(date,DATF,105)) as miadata,
       SUM(CAST(NETTO AS INT)) AS quanti 
    from 
       MOVIMENTI 
    where  
       (CAUS IN ('01', '02','65')) 
       AND (MOVIMENTI.SMAL = '900000.0002')
    group by  
       datepart(mm,CONVERT(date,DATF,105)),datename(month,CONVERT(date,DATF,105))
    order by 
       datepart(mm,CONVERT(date,DATF,105))

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.