Wednesday, 14 August 2013

replacing MySQL query(Date_format,Case) to Ms-Acccess query(Format,IFF)

replacing MySQL query(Date_format,Case) to Ms-Acccess query(Format,IFF)

I have MySQL Query like this
SELECT p.Per_Code as NIP,
p.Per_Name as Nama,
DATE_FORMAT (a.Date_Time,
'%Y-%m-%d') as date,
Case Min(a.Date_Time)
When Max(a.Date_Time)
Then ''
Else
DATE_FORMAT(a.Date_Time,
'%H:%i:%s')
End as InTime,
DATE_FORMAT(max(a.Date_Time),
'%H:%i:%s') as OutTime
FROM HR_Personnel as p
RIGHT JOIN TA_Record_Info a
ON p.ID=a.Per_ID
Group By NIP,
Nama,
DATE_FORMAT(Date_Time, '%Y-%m-%d')
This my Example MYSQL Query Testing
And then I want to make it to ms Access: This is my experiment query on
msaccess query.But still Not Working This my Example Query Testing Still
Error
SELECT p.Per_Code AS NIP,
p.Per_Name AS Nama,
Format (a.Date_Time, "yyyy-mm-dd"),
IIF(
(Min(a.Date_Time) = Max(a.Date_Time)) ,
'',
Format (a.Date_Time, "hh/mm/ss")
),
Format (Max(a.Date_Time), "hh/mm/ss") AS OutTime FROM HR_Personnel AS p
RIGHT JOIN TA_Record_Info a ON p.ID=a.Per_ID GROUP BY NIP,Nama,Format
(a.Date_Time, "yyyy-mm-dd")
What must i change from my msaccess query so that working?

No comments:

Post a Comment