Hi,
I have a basic CMS that is running on MS Access. I'm trying to convert my queries to run on a mysql server too, but I'm having some trouble with one of them (and my sql knowledge is limited).
Basically, I have two tables, one is called [articles] and the other is called [authors].
The [articles] table has the following fields:
- articles_id (autonumber)
- article_title
- author_id
The [authors] table has the following fields:
- id (autonumber)
- author_name
The author_id field in the articles table stores the id of the articles's author. There is no relationship drawn between the two tables.
So... In MS Access, the following SQL displays all the articles in the database along with the names of their authors:
SELECT article_id, article_title, (SELECT author.author_name FROM authors WHERE articles.author_id = authors.id) AS author_name FROM articles ORDER BY id
However, in mysql, only the article_id and article_title are returned. Any idea what I'm doing wrong?
Thanks.
I have a basic CMS that is running on MS Access. I'm trying to convert my queries to run on a mysql server too, but I'm having some trouble with one of them (and my sql knowledge is limited).
Basically, I have two tables, one is called [articles] and the other is called [authors].
The [articles] table has the following fields:
- articles_id (autonumber)
- article_title
- author_id
The [authors] table has the following fields:
- id (autonumber)
- author_name
The author_id field in the articles table stores the id of the articles's author. There is no relationship drawn between the two tables.
So... In MS Access, the following SQL displays all the articles in the database along with the names of their authors:
SELECT article_id, article_title, (SELECT author.author_name FROM authors WHERE articles.author_id = authors.id) AS author_name FROM articles ORDER BY id
However, in mysql, only the article_id and article_title are returned. Any idea what I'm doing wrong?
Thanks.