industriality
04-27-2006, 03:35 AM
I have two mySQL tables, "news" and "journal". Both tables have these columns: id, date, headline, body. Journal also contains an author column.
How would I construct a simple mySQL SELECT query to pull from both tables at the same time, and order the entire list by date? I think a join may be in order, but I'm confused by the documentation.
The date column in both tables is formatted YYYY-MM-DD.
The result should be able to be formatted like this (simple xml)
<entries>
<entry>
<type>news</type>
<id>53</id>
<name>This is a news entry headline</name>
<body>This is the body text.</body>
<author>This is the author</author>
</entry>
<entry>
...
</entry>
</entries>
This is for a band website. The goal here is to be able to view news and journal entries in one combined listing, and also generate an RSS feed from that combined list.
How would I construct a simple mySQL SELECT query to pull from both tables at the same time, and order the entire list by date? I think a join may be in order, but I'm confused by the documentation.
The date column in both tables is formatted YYYY-MM-DD.
The result should be able to be formatted like this (simple xml)
<entries>
<entry>
<type>news</type>
<id>53</id>
<name>This is a news entry headline</name>
<body>This is the body text.</body>
<author>This is the author</author>
</entry>
<entry>
...
</entry>
</entries>
This is for a band website. The goal here is to be able to view news and journal entries in one combined listing, and also generate an RSS feed from that combined list.