V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
MySQL 5.5 Community Server
MySQL 5.6 Community Server
Percona Configuration Wizard
XtraBackup 搭建主从复制
Great Sites on MySQL
Percona
MySQL Performance Blog
Severalnines
推荐管理工具
Sequel Pro
phpMyAdmin
推荐书目
MySQL Cookbook
MySQL 相关项目
MariaDB
Drizzle
参考文档
http://mysql-python.sourceforge.net/MySQLdb.html
caneman
V2EX  ›  MySQL

如何把 MySQL 存储过程查询的结果作为一张表进行进一步查询?

  •  
  •   caneman · 2019-06-24 17:47:51 +08:00 · 3746 次点击
    这是一个创建于 1761 天前的主题,其中的信息可能已经有所发展或是发生改变。

    例如

    create procedure a (in id int)
    begin
    select * from goods where cate_id = id;
    end;
    

    我想在 a 的结果中进一步查询,该怎么实现呢?

    还有就是在以上的基础上,如何给id设置一个默认值?

    2 条回复    2019-06-24 17:55:24 +08:00
    quadrapop
        1
    quadrapop  
       2019-06-24 17:50:56 +08:00
    mysql 临时表很坑,把结果放进游标里咯
    caneman
        2
    caneman  
    OP
       2019-06-24 17:55:24 +08:00
    @quadrapop 如果结果集很大呢?游标会不会影响效率?
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2916 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 03:51 · PVG 11:51 · LAX 20:51 · JFK 23:51
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.