Jump to content

relationship type?


Destramic

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/225519-relationship-type/
Share on other sites

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.