SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Zealot
    Join Date
    Aug 2010
    Posts
    125
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    how to write a simple code for MySQL Multiple Table query?

    HTML Code:
    $db = mysql_connect("localhost","root","root") or dir("can not connect Mysql Server");
    mysql_select_db("mydb",$db) or dir("can not connect Mysql Server");
    I have many tables under mydb. They all have the same field names.
    " id, name, detail, date". The table name is from table001 - table121.
    How to make a MySQL Multiple Table query with short code and high efficient? Thanks.

    (Apache/2.2.13 , PHP/5.2.11, MySQL 5.0.51a)

  2. #2
    SitePoint Member
    Join Date
    Sep 2010
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What do you want the query to do? Or to put it a better way, what data do you want to collect and what do you want to do with it?

  3. #3
    SitePoint Zealot
    Join Date
    Aug 2010
    Posts
    125
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hello, I want do a simple php intranet search. I do not want to write a long long query code.
    These tables are some Books directory. book name, book introduction and added date.

  4. #4
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,220
    Mentioned
    58 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by youlichika View Post
    I have many tables under mydb. They all have the same field names.
    " id, name, detail, date". The table name is from table001 - table121.
    that's going to be a huge problem

    really, is there any chance you can combine them into one table?

    what was the idea behind separate tables?
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  5. #5
    SitePoint Zealot
    Join Date
    Aug 2010
    Posts
    125
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi r937, each table is one Book directory: such as science, culture, science fiction...
    If conbain them, it also will be a big project...

  6. #6
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,220
    Mentioned
    58 Post(s)
    Tagged
    3 Thread(s)
    they should definitely be combined
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •