dongyongju9560 2015-10-01 07:11
浏览 73

根据列号在多个表中搜索

table1 has 6 column

table2 has 8 columntable3 has 10 columntable4 has 12 column

all the tables have a common NAME, say pid. i want to make a query in PHP which says, if, pid is found in table1, send the data to PHP query or else search in table2, or if not found, search in table3 or next in table4.

is there any way i can differentiate before hand based on column numbers, which table to search before making the query in PHP.

  • 写回答

2条回答 默认 最新

  • doujiacai4986 2015-10-01 07:24
    关注

    If you have query on integer value. Then You can maintain a Range table for that. It stores only table name like table1 and its minimum key value and maximum key value. If any query on that integer value then we can found the table name from which this record belong by using range table and get it from target table like table1. Range table is small, its have 5-6 records as you said so very less time taking. Now go to your destination table and find data.

    Caution: This methods have its own pros & cons. I am just sharing my views

    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度