V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
MonkeyDLuffy
V2EX  ›  程序员

sql 临时表 求指点

  •  
  •   MonkeyDLuffy · 2016-06-08 14:51:25 +08:00 · 1905 次点击
    这是一个创建于 2896 天前的主题,其中的信息可能已经有所发展或是发生改变。

    SELECT bj.billno,bj.lotto_type,bj.site_id,bj.username,bj.trans_id FROM ds_beijing_lotto bj,temp t bj WHERE bj.billno=t.billno UNION SELECT cq.billno,cq.lotto_type,cq.site_id,cq.username,cq.trans_id FROM ds_chongqing_lotto bj ,temp t cq WHERE cq.billno=t.billno

    请问下 后面的 temp 是临时表

    能不能让 temp 只查询一次

    如果查询 2 次会出现 cant reopen temp 异常

    2 条回复    2016-06-08 16:46:11 +08:00
    MonkeyDLuffy
        1
    MonkeyDLuffy  
    OP
       2016-06-08 14:54:07 +08:00
    可以实现吗?
    SmiteChow
        2
    SmiteChow  
       2016-06-08 16:46:11 +08:00
    一个 query
    select * from table A, table B, table C where A.billno=B.billno and B.billno=C.billno;
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   5672 人在线   最高记录 6547   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 08:49 · PVG 16:49 · LAX 01:49 · JFK 04:49
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.