Destramic Posted January 24, 2011 Share Posted January 24, 2011 hey guys im trying to workout what relationship my tables are: one to one, one to many, many to many. here are my tables and query news --------- news_id user_id news ---------- users --------- user_id username --------- news_comments -------------- news_comment_id news_id comment ------------ query: SELECT n.news_id, n.news, n.date, n.time, u.username, count(nc.news_id) AS comments FROM news n LEFT JOIN news_comments nc ON n.news_id = nc.news_id LEFT JOIN users u ON n.user_id = u.user_id Group by n.news_id now i just want to know if im correct by saying my users table is one to one and the news_comments is one to many...im just trying to learn....thank you Quote Link to comment https://forums.phpfreaks.com/topic/225519-relationship-type/ Share on other sites More sharing options...
mikosiko Posted January 24, 2011 Share Posted January 24, 2011 some examples here... read and you should be able to answer yourself http://net.tutsplus.com/tutorials/databases/sql-for-beginners-part-3-database-relationships/ Quote Link to comment https://forums.phpfreaks.com/topic/225519-relationship-type/#findComment-1164530 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.