VLC_search_type= ALL VLC_search_string= VLC_instrumento= ALLSELECT shw.shw_ukey, shw.shw_001_c, shw.shw_002_c, shw.shw_007_c, shw.shw_015_c, shw.shw_016_i, shw.shw_019_c, shw.shw_020_c, MAX(agg.total_vendido) AS total_vendido, MAX(agg.shw_016_i_agg) AS shw_016_i_agg FROM shw INNER JOIN shwXmap ON shw.shw_ukey = shwXmap.shw_ukey INNER JOIN map ON map.map_ukey = shwXmap.map_ukey LEFT JOIN ( SELECT shw.shw_ukey, ISNULL(SUM(CASE WHEN ped.ped_017_c = '3' THEN ite.ite_001_n ELSE 0 END),0) AS total_vendido, MAX(TRY_CONVERT(INT, shw.shw_016_i)) AS shw_016_i_agg FROM shw LEFT JOIN ite ON ite.shw_ukey = shw.shw_ukey LEFT JOIN ped ON ped.ped_ukey = ite.ped_ukey GROUP BY shw.shw_ukey ) agg ON agg.shw_ukey = shw.shw_ukey WHERE shw_018_c = 'S' ) GROUP BY shw.shw_ukey, shw.shw_001_c, shw.shw_002_c, shw.shw_007_c, shw.shw_015_c, shw.shw_016_i, shw.shw_019_c, shw.shw_020_c ORDER BY CASE WHEN MAX(agg.shw_016_i_agg) > 0 AND MAX(agg.shw_016_i_agg) <> 100 THEN 1 WHEN MAX(agg.shw_016_i_agg) = 100 THEN 2 ELSE 3 END, MAX(agg.total_vendido) DESC, CAST(CONVERT(NVARCHAR(255), shw.shw_002_c) AS VARCHAR(255))
Microsoft OLE DB Provider for SQL Server
error '80040e14'
Incorrect syntax near ')'.
/busca.asp, line 313