By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,216 Members | 1,023 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,216 IT Pros & Developers. It's quick & easy.

Multiple MySQL tables

P: n/a
Hello!

I need some help with tables in MySQL.
I am making a colums of articles in my site.
It has 3 posters that post articles.
I make a little serach page to search for words into articles.

I have the sintax below working, but I need to know what is the syntax
to it select words from several tables. Every table is for a poster
and all tables are in the same DB and have the same fields.

---------------
$searchword="SELECT * FROM table WHERE comment LIKE
'%$searchstring%'";
---------------

I tried
---------------
$searchword="SELECT * FROM table, table1, table2 WHERE selected_row
LIKE '%$searchstring%'";
---------------

and even make an ARRY for table, table1, table2 but it does not work.

Can you help me?

Sincerely,
Carlos
Jul 16 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a

On 17-Aug-2003, ar****@hotmail.com (Carlos Marangon) wrote:
I need some help with tables in MySQL.
I am making a colums of articles in my site.
It has 3 posters that post articles.
I make a little serach page to search for words into articles.

I have the sintax below working, but I need to know what is the syntax
to it select words from several tables. Every table is for a poster
and all tables are in the same DB and have the same fields.

---------------
$searchword="SELECT * FROM table WHERE comment LIKE
'%$searchstring%'";
---------------

I tried
---------------
$searchword="SELECT * FROM table, table1, table2 WHERE selected_row
LIKE '%$searchstring%'";
---------------

and even make an ARRY for table, table1, table2 but it does not work.

Can you help me?


You need to do a separate query for each table. The select from multiple
table is used to join related rows in multiple tables together, I don't
think that's what you want.

--
Tom Thackrey
www.creative-light.com
Jul 16 '05 #2

P: n/a
Why three tables for three different posters? Stick it in one table with
an index on a 'poster' (some int) row?

Why.

Carlos Marangon wrote:
Hello!

I need some help with tables in MySQL.
I am making a colums of articles in my site.
It has 3 posters that post articles.
I make a little serach page to search for words into articles.

I have the sintax below working, but I need to know what is the syntax
to it select words from several tables. Every table is for a poster
and all tables are in the same DB and have the same fields.

---------------
$searchword="SELECT * FROM table WHERE comment LIKE
'%$searchstring%'";
---------------

I tried
---------------
$searchword="SELECT * FROM table, table1, table2 WHERE selected_row
LIKE '%$searchstring%'";
---------------

and even make an ARRY for table, table1, table2 but it does not work.

Can you help me?

Sincerely,
Carlos


Jul 16 '05 #3

P: n/a
SQL provides the UNION operation, and it is/will be supported by newer
MySQL versions. Check your mysql for it!

Regards!
Rainer

Carlos Marangon schrieb:
Hello!

I need some help with tables in MySQL.
I am making a colums of articles in my site.
It has 3 posters that post articles.
I make a little serach page to search for words into articles.

I have the sintax below working, but I need to know what is the syntax
to it select words from several tables. Every table is for a poster
and all tables are in the same DB and have the same fields.

---------------
$searchword="SELECT * FROM table WHERE comment LIKE
'%$searchstring%'";
---------------

I tried
---------------
$searchword="SELECT * FROM table, table1, table2 WHERE selected_row
LIKE '%$searchstring%'";
---------------

and even make an ARRY for table, table1, table2 but it does not work.

Can you help me?

Sincerely,
Carlos

--
------------------------------------------------
Rainer Herbst Linux - Registered
ZEIK User #319157
Universitšt Potsdam Usual disclaimers applies!
------------------------------------------------

Jul 16 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.