Announcement

Collapse
No announcement yet.

[SOLVED] URGENT after update to 8.1.034 version does not work some queries containing ORDER BY

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • [SOLVED] URGENT after update to 8.1.034 version does not work some queries containing ORDER BY

    MS SQL SERVER:
    SELECT sc.Codice,sc.Descrizione,sc.Citta,sc.FlgInattivo,I SNULL(ms.codcategoria,0) AS categoria,mf.descrizione AS desc0,ms.codfiltro1,mf1.descrizione AS desc1,ms.codfiltro2,mf2.descrizione AS desc2,ms.codicelocazione,(SELECT COUNT(*) FROM Magaz m WHERE m.CodSito=sc.Codice) AS numdis
    FROM SitCli sc
    LEFT JOIN Clienti c ON c.Codice=sc.CodCliente
    LEFT JOIN mio_sitcli ms ON ms.codice=sc.Codice
    LEFT JOIN mio_filtri mf ON mf.codice=ms.codcategoria
    LEFT JOIN mio_filtri mf1 ON mf1.codice=ms.codfiltro1
    LEFT JOIN mio_filtri mf2 ON mf1.codice=ms.codfiltro2
    WHERE sc.CodCliente>0
    ORDER BY sc.Codice

    ERROR:
    Errore durante l'accesso alla banca dati:
    SQLState: 42000 Error Code: 1033 Message: [Microsoft][SQL Server Native Client 11.0][SQL Server]The ORDER BY clause is invalid in views, inline functions, derived tables, subqueries, and common table expressions, unless TOP or FOR XML is also specified.
    select count(*) from (SELECT sc.Codice, sc.Descrizione, sc.Citta, sc.FlgInattivo, ISNULL(ms.codcategoria,0) AS categoria, mf.descrizione AS desc0, ms.codfiltro1, mf1.descrizione AS desc1, ms.codfiltro2, mf2.descrizione AS desc2, ms.codicelocazione, (SELECT COUNT(*) FROM Magaz m WHERE m.CodSito=sc.Codice) AS numdis FROM SitCli sc LEFT JOIN Clienti c ON c.Codice=sc.CodCliente LEFT JOIN mio_sitcli ms ON ms.codice=sc.Codice LEFT JOIN mio_filtri mf ON mf.codice=ms.codcategoria LEFT JOIN mio_filtri mf1 ON mf1.codice=ms.codfiltro1 LEFT JOIN mio_filtri mf2 ON mf1.codice=ms.codfiltro2 WHERE sc.CodCliente>0 ORDER BY sc.Codice ) nm_sel_esp

  • #2
    Dont double post please. It is an error in your query. Thisis not a scriptcase error but a sqlserver error. Your ORDER BY sc.Codice is not allowed ther as the error already says.

    Comment

    Working...
    X