Question about 'group by' in Access

  • Thread starter Thread starter afatdog
  • Start date Start date
A

afatdog

SELECT
FORMAT(T_YZ_JYJL.JYSJ, 'YYYY-MM-DD'), <<-- here!
SUM(T_YZ_JYJL.JYSL) AS JYSL
FROM
T_YZ_JYJL
WHERE
FORMAT(T_YZ_JYJL.JYSJ, 'YYYY-MM-DD') = '2004-01-05'
GROUP BY
FORMAT(T_YZ_JYJL.JYSJ, 'YYYY-MM-DD') <<-- here!
ORDER BY
T_YZ_JYJL.JYSJ


Where is wrong?
 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Is this an Access (JET) query or an SQL Server query (the date format
is SQL'r date format and the Format() function won't work in an SQL
query because it is an Access function - which works in JET queries).

Try this instead (Assumes SQL'r query):

SELECT
T_YZ_JYJL.JYSJ,
SUM(T_YZ_JYJL.JYSL) AS JYSL
FROM
T_YZ_JYJL
WHERE
T_YZ_JYJL.JYSJ = '2004-01-05'
GROUP BY
T_YZ_JYJL.JYSJ
ORDER BY
T_YZ_JYJL.JYSJ


- --
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQCQqxYechKqOuFEgEQLYmgCcClgExzVUrkjVsA0tyCqWJ+L/Gp4AnjMi
81xI5iEcVxIfl5TZ729F6XKe
=1UZD
-----END PGP SIGNATURE-----
 
Back
Top