执行此查询时遇到错误

时间:2019-12-27 10:10:45

标签: mysql sql jira mysql-error-1064 jira-agile

请帮助我。执行查询时遇到错误。

  

错误:类型“ unsigned”不存在

     

第3行:FROM_UNIXTIME((CAST(attribute_value AS UNSIGNED)/ 1000))   ...

SQL状态:42704 角色:118

查询:

SELECT    d.directory_name                                        AS "Directory", 
          u.user_name                                             AS "Username", 
          From_unixtime((Cast(attribute_value AS UNSIGNED)/1000)) AS "Last Login" 
FROM      cwd_user u 
JOIN      cwd_directory d 
ON        u.directory_id = d.id 
LEFT JOIN cwd_user_attributes ca 
ON        u.id = ca.user_id 
AND       ca.attribute_name = 'login.lastLoginMillis' 
WHERE     u.active = 1 
AND       d.active = 1 
AND       u.lower_user_name IN 
                                ( 
                                SELECT DISTINCT lower_child_name 
                                FROM            cwd_membership m 
                                JOIN            licenserolesgroup gp 
                                ON              m.parent_name = gp.group_id) 
AND       ( 
                    u.id IN 
                    ( 
                           SELECT ca.user_id 
                           FROM   cwd_user_attributes ca 
                           WHERE  attribute_name = 'login.lastLoginMillis' 
                           AND    From_unixtime(Round(ca.attribute_value/1000)) <= (CURRENT_DATE - interval '6 month'))
          OR        u.id NOT IN 
                    ( 
                           SELECT ca.user_id 
                           FROM   cwd_user_attributes ca 
                           WHERE  attribute_name = 'login.lastLoginMillis') ) 
ORDER BY  "Last Login" DESC;

0 个答案:

没有答案