Home > database >  Old library QQ pet name corresponding to the name of the group no. Millions of database query proble
Old library QQ pet name corresponding to the name of the group no. Millions of database query proble

Time:10-08

QQ number library
Contains: 1-11 library
Each library: it contains 100 tables, that is, a total of around 1100 tables,

Group of library:
Contains: 1-11 library
Each library: it contains 100 tables, that is, a total of around 1100 tables,

Think now through QQ nickname search library, put all the specified nickname extracted, and then query the corresponding library 11 group, the group name displayed,

QQ library query I used the temporary table, because QQ number database table name and QQ name regularly, with two variables to add a loop can achieve full stored into temporary table, but let the results of the query to the group no., then sweep 11 group reservoirs respectively, don't know how to operate, if use cursor, one by one to check the feeling is very time consuming, did anyone give a train of thought,

Namely: query nickname: SELECT * FROM QQ library (11 libraries form 1100) WHERE a nickname LIKE specified nickname, temporary table exists among group no.
But now I don't know how to through the group no. Connected group of the library table, group no. 11 possible group of library library from any one of the 1100 tables in the table, I as long as one of the record,

CodePudding user response:

Suggest a new Q group index table: the database name, table name, group no....
Check the group no. Directly through the table access to the database name and the name of the table first, form a dynamic SQL to access the specified table. Avoiding traversal of all tables.

CodePudding user response:

It's nice, it's good to write
  • Related