Visualizzazione dei risultati da 1 a 5 su 5

Discussione: problemino con where

  1. #1

    problemino con where

    codice:
    "Select Year(Data) as Anni from News group BY Year(Data) order BY Year(Data) Desc"
    e fin qui tutto bene ma se volessi filtrarla aggiungendo anche un'altro campo tipo:

    codice:
    "Select Cat, Year(Data) as Anni from News group BY Year(Data) where Cat= " & Cat & " order BY Year(Data) Desc"

    Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
    [Microsoft][Driver ODBC Microsoft Access] Errore di sintassi (operatore mancante) nell'espressione della query 'Year(Data) where Cat= 2'.


    Sto fondendo ?

  2. #2
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    La GROUP BY va dopo la WHERE...

    Roby

  3. #3
    codice:
    "Select Cat, Year(Data) as Anni from News Where Cat=" & Cat & " Group by Year(Data) order by Year(Data) desc"

    il risultato non mi cambia purtroppo

    Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
    [Microsoft][Driver ODBC Microsoft Access] Impossibile eseguire una query che non include l'espressione "Cat" specificata come parte di una funzione di aggregazione.

  4. #4
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Devi "aggregare" anche per "Cat" te lo dice...

    Roby

  5. #5
    Group by Year(Data), Cat , fantastik !

    Grazie

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.