I have three tables of different data which I need to make a search in.

Every table has a column for date, heading, body and author.
I need to be able to search (WHERE column LIKE 'search') in heading, body
and/or author in all three tables, ORDER BY the latest date, and LIMIT 20.

If I want to make a search for 'MySQL' in all the headings and order it by
the latest date, what is the SQL-syntax for this? I suspect this is done
with joins, but I haven´t really figured them out yet.

I use mysql 3.23.28-gamma, if that is of any use for you...

The tables looks like this:
+-----------+--------------+
| Field     | Type         |
+-----------+--------------+
| date      | varchar(40)  |
| heading   | varchar(255) |
| body      | text         |
| author    | varchar(255) |
+-----------+--------------+

The output I am looking for from the example above:

+-----------+--------------+--------------+--------------+
| heading   | body         | author       | Date         |
+-----------+--------------+--------------+--------------+
| MySQL etc | free...      | John         | 2000-01-05   |
| MySQL etc | open...      | Thomas       | 2000-01-04   |
| MySQL etc | Type...      | James        | 2000-01-03   |
| MySQL etc | words...     | Maria        | 2000-01-02   |

Does it make any sence?
Thanks,
// Tobias


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to