06-06-2012, 12:25 PM
[eluser]emily12[/eluser]
Hi, I'm trying to get 4 article tables, 4 comments tables, 1 article type table, and a user table to get all of the comments in my project. But I can't seem to understand what's wrong with even the most basic code.
This is the most recent version of the simplified mysql query and it gives me the following error:
#1222 - The used SELECT statements have a different number of columns
I had been advised to use http://dev.mysql.com/doc/refman/5.0/en/create-view.html as reference but I can't seem to understand how to use it. Can anyone please help me? I have until monday before this project is due and I already had my teacher extend it from friday so it will be interesting to see what happens until then
Thank you for your time!
EDIT: Here's the idea behind what I hope the final thing for that module will be
Hi, I'm trying to get 4 article tables, 4 comments tables, 1 article type table, and a user table to get all of the comments in my project. But I can't seem to understand what's wrong with even the most basic code.
Code:
SELECT * FROM `entertainment` b LEFT OUTER JOIN `entertainment_comments` ON (0) WHERE cme_articles_article = `earticleid`
UNION ALL
SELECT * FROM `articles` b RIGHT OUTER JOIN `articles_comments` ON (0) WHERE cm_articles_article = `articleid`
This is the most recent version of the simplified mysql query and it gives me the following error:
#1222 - The used SELECT statements have a different number of columns
I had been advised to use http://dev.mysql.com/doc/refman/5.0/en/create-view.html as reference but I can't seem to understand how to use it. Can anyone please help me? I have until monday before this project is due and I already had my teacher extend it from friday so it will be interesting to see what happens until then

Thank you for your time!
EDIT: Here's the idea behind what I hope the final thing for that module will be
Quote:articles contains the article themselves for standard articles
categories contains the categories for the standard articles section
comments contains the comments that were published for these articles
entertainment contains the article themselves for the Entertainment section
entertainment_type is the article type for entertainment, this is used to know if it's information / review / etc. full urls are generated thanks to this
entertainment_comments contains the comments that were published for the entertainment section
users is the user list. it is joined by the comment author when needed. The standard articles uses the categories table to define the url similarly to what the entertainment_type does. Why is it this way? Because I wanted to learn something about migrations, and this was a little over my head lol
Quote:User
Comment body
Date (sorted by newest)
Category OR category type