Could you tell me how to write a database for the SQL statement used for full table search in PHP? there are many tables (10-30 ), then, I need to search for the data contained in a field in all the tables below. for example, I need to find all the fields in the table below that contain three pieces of data. Normally, I know the statement select & nbsp; * & nbsp; from & nbsp; name & nbsp; where & nbsp; name zhang san: how should I write the SQL statement used by PHP to perform full table search?
A database has many tables (10-30). then I need to search for the data contained by a field in all the tables below.
For example, I need to find all the fields in the table below that contain three pieces of data.
Normally, I know the statement used to query a single table field in MYSQL.
Select * from name where name = 'zhangsan'. I don't know how to write SQL statements if all the tables are used.
If I use PHP for this search page
$ Over = $ _ POST [''title];
$ SQL = "select * from" // How to write the following code
------ Solution --------------------
Must be completed with a program
See phpmyadmin's "search" function.
------ Solution --------------------
Generally, it is not a single query,
Method 1 if the data volume is large, you can import the data and use sphinx for search.
Method 2 if the table data does not change much, you can combine dozens of tables into one and search
Method 3 use union
Select content from table1 where name = 'Zhang san'
Union
Select content from table2 where name = 'zhangsan'
..................