fluidsharp Posted July 28, 2011 Share Posted July 28, 2011 Hi all, I have two tables: article and records (haven't create but will be same as article) article: +-------------+------------- ----+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-------------+------------------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | title | varchar(255) | NO | | NULL | | | description | text | NO | | NULL | | | article | text | NO | | NULL | | | review | int(11) | NO | | NULL | | | author | varchar(255) | YES | | NULL | | | date | date | NO | | NULL | | So I must output data (news) from both tables and result should be ordered by date. First idea putted all in one table but it is so stupid. Second is creating some intermediary table but how I haven't imagined yet. Thank you in advance! Quote Link to comment https://forums.phpfreaks.com/topic/243097-structure-for-outputing-news-from-two-tables/ Share on other sites More sharing options...
mikosiko Posted July 28, 2011 Share Posted July 28, 2011 no clear enough what your tables "articles" and "records" represent, but if both tables are identical I don't see stupidity in use just one table... just add a "type" field to differentiate each other Quote Link to comment https://forums.phpfreaks.com/topic/243097-structure-for-outputing-news-from-two-tables/#findComment-1248517 Share on other sites More sharing options...
fluidsharp Posted July 28, 2011 Author Share Posted July 28, 2011 I mean identical by structure(fields) but not by data. Table record will contain an info about recorded interview, short description, etc. And table article of course contains articles and additional info. Quote Link to comment https://forums.phpfreaks.com/topic/243097-structure-for-outputing-news-from-two-tables/#findComment-1248564 Share on other sites More sharing options...
mikosiko Posted July 28, 2011 Share Posted July 28, 2011 my first answer still valid.... adding a "type" field to differentiate is a valid solution But of course the decision of implement a unique table is going to depend on what exactly are you trying to accomplish or modeling Quote Link to comment https://forums.phpfreaks.com/topic/243097-structure-for-outputing-news-from-two-tables/#findComment-1248584 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.