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
https://forums.phpfreaks.com/topic/271755-query-whit-2-columns/
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.

 

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.