V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
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
michaelroshen
V2EX  ›  MySQL

嵌套 sql 求助!

  •  
  •   michaelroshen · Jun 16, 2016 · 2144 views
    This topic created in 3614 days ago, the information mentioned may be changed or developed.

    h1. 需求表( A )

    h1. 数据表( B )

    根据表 A 里面的 internalname, worktime 关联 B 表,并随机取出关联后的数据(数量为 A 表中的 hx )

    举例:

    id-- internalname| 3-- abc 5-- abc 6-- abc

    A 表中 abc 对应的 xh 为 3 ,所以随机取出 B 表中的三条记录 A 表中 ccc 对应的 xh 为 0, 所以不取

    请教 sql 如何写?

    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2958 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 07:26 · PVG 15:26 · LAX 00:26 · JFK 03:26
    ♥ Do have faith in what you're doing.