CodeIgniter-MY_Model
CodeIgniter-MY_Model copied to clipboard
How to SELECT an article and author in one query
Hi, I have two tables: "article" and "user" In the article tab I have a "user_id"
How can I make a single query that allows me to select * from article but also show me the name and lastname of the user from the user table rather than the user_id.
Thank you.
To follow most of MY_Model's code standard and recommendation, your tables should be called articles and users. Nevertheless, it is has_one relation in Article_m model and has_many relation in User_m model. Similar example you can find in documentation (related to User and Posts).