Jump to content

Query Whit 2 Columns


madness69

Recommended Posts

Could someone tell me what is the query for what im trying to do, for example:

i have 2 tables, one is "comments" table and the other is "articles" tables.

In the comments table there is a 3 columns (id, title, message) and in the articles table there is 3 columns too(id, title,info)

I would like is to get all the data of the column message from the table "comments" but the table "comments" got to have the same title of the column title of the column title of Articles table.

I dont no if im beign confusing, im sorry.

Link to comment
Share on other sites

You should be linking the comments with the article by the article's ID number, not the title.  It's quicker to compare a couple of INTs than it is to compare strings.  It would also use a lot less space on the system to store those INTs than to store a copy of the title.  You also won't have any issues if the article title ever gets changed.

 

Link to comment
Share on other sites

I would like is to get all the data of the column message from the table "comments" but the table "comments" got to have the same title of the column title of the column title of Articles table.

 

According to to OP all that is required is message column from comments table. I am totally confused about requirements here. It's later been established that title columns are the same so why mention that constraint.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.