联系官方销售客服

1835022288

028-61286886

开发框架 版主:迅睿框架研发组
Unknown column 'updatetime' in 'order clause'
类型:迅睿CMS 更新时间:2020-03-12 09:20:19

PHP程序里面

Unknown column 'updatetime' in 'order clause'

SQL查询里面报未知的列错误,下面是一个多表查询的代码

        {php $query='SELECT * FROM (( SELECT id, title, author, thumb, updatetime FROM dr_1_zikao ORDER BY updatetime DESC ) UNION ALL
    ( SELECT id, title, author, thumb, updatetime FROM dr_1_chengkao ORDER BY updatetime DESC ) UNION ALL
    ( SELECT id, title, author, thumb, updatetime FROM dr_1_zsben ORDER BY updatetime DESC ) UNION ALL
    ( SELECT id, title, author, thumb, updatetime FROM dr_1_dianda ORDER BY updatetime DESC ) UNION ALL
( SELECT id, title, author, thumb, updatetime FROM dr_1_yuanch ORDER BY updatetime DESC )) AS info 
ORDER BY
    updatetime DESC 
    LIMIT 2000';}
        {list action=sql sql='$query' page=1 pagesize=2 urlrule=index.php?s=info&c=category&id=1&page=[page]}
        <li>
            <div class="list_l_b_img fl">
                <img src="{dr_thumb($t['thumb'], 135, 75)}" alt="">
            </div>
            <div class="list_l_b_tit fl">
                <h3><a  target="_blank" href="{$t['url']}">{$t['title']}</a></h3>
                <div class="list_zbrq">
                    <span>责编:{$t.author}</span>
                    <span>{dr_date($t['updatetime'], 'Y-m-d')}</span>
                </div>
            </div>
        </li>
        {/list}

运行正常,能取出数据,但是页面报错,怎么解决?

QQ截图20200312040053

回帖
  • #1楼    迅睿框架创始人
    2020-03-12 04:52:53
    Google Pixel 手机 0
    UNION 不要用,查询速度太慢了
  • 二开/定制/使用解答专家
    #2楼    二开/定制/使用解答专家
    2020-03-12 07:20:25
    Chrome 0
    {php $query=urlencode('SELECT * FROM (( SELECT id, title, author, thumb, updatetime FROM dr_1_zikao ORDER BY updatetime DESC ) UNION ALL
        ( SELECT id, title, author, thumb, updatetime FROM dr_1_chengkao ORDER BY updatetime DESC ) UNION ALL
        ( SELECT id, title, author, thumb, updatetime FROM dr_1_zsben ORDER BY updatetime DESC ) UNION ALL
        ( SELECT id, title, author, thumb, updatetime FROM dr_1_dianda ORDER BY updatetime DESC ) UNION ALL
    ( SELECT id, title, author, thumb, updatetime FROM dr_1_yuanch ORDER BY updatetime DESC )) AS info 
    ORDER BY
        id DESC 
        LIMIT 2000');}
    表不要查询多了,慢死的
  • 欢喜哥
    #3楼    欢喜哥
    2020-03-12 09:20:19
    Chrome 0
    二楼是大神,多表联合是他帮我写的