具有多个子查询的Mysql更新表在同一个表中

时间:2015-08-27 19:05:10

标签: mysql

我正在使用多个子查询在同一个表中转换列日期时间格式。我收到一个错误,我的表不存在。

这是我的问题:

update mytable as t
set t.PO_Date = (
   select DATE_FORMAT(STR_TO_DATE(PO_Date, '%m/%d/%Y'), '%Y-%m-%d') 
   from mytable as i 
   where i.Pri_ID = (select MAX(Pri_ID) from mytable)
);

我尝试多次更改表别名,一直收到别名t不存在的错误。

1 个答案:

答案 0 :(得分:0)

如果将来有人偶然发现这个问题,这就是纠正这个问题的原因。

gg <- m + scale_x_continuous(expand = c(0,0), limits = c(0, 1.1), breaks=c(0.0, 0.5, 1.0),
                       labels=c(0, 5, 10)) +
    theme(panel.grid=element_blank())


gb <- ggplot_build(gg)

gt <- ggplot_gtable(gb)

gt$grobs[[4]]$children[[2]]$gp$fill <- "#7f7f7f"

gt$grobs[[2]]$children$axis$grobs[[1]]$label <- gt$grobs[[2]]$children$axis$grobs[[1]]$label[1:3]
gt$grobs[[2]]$children$axis$grobs[[1]]$y <- gt$grobs[[2]]$children$axis$grobs[[1]]$y[1:3]
gt$grobs[[2]]$children$axis$grobs[[2]]$y <- gt$grobs[[2]]$children$axis$grobs[[2]]$y[1:6]

grid.newpage()
grid.draw(gt)