Ad
NEED HELP **triggers With Join**
two tables
users
- user_id , username , password , email
posts
- user_id , post_id , post
i want to join these two tables by user_id and create new table
posts_join
- user_id , username , post
but now i dont know how to make trigger of this problem i want to update post_join when there is an insertion in posts table
Ad
Answer
The posts_join
table is duplicating the function of the foreign key in the posts
table.
Remove the posts_join
table from your database and replace it with a view:
create view posts_join
as
select u.user_id
, username
, post
from posts p
join users u
on u.user_id = p.user_id
Ad
source: stackoverflow.com
Related Questions
- → "failed to open stream" error when executing "migrate:make"
- → October CMS Plugin Routes.php not registering
- → OctoberCMS Migrate Table
- → OctoberCMS Rain User plugin not working or redirecting
- → October CMS Custom Mail Layout
- → October CMS - How to correctly route
- → October CMS create a multi select Form field
- → October CMS - Conditionally Load a Different Page
- → How to disable assets combining on development in OctoberCMS
- → October CMS - Radio Button Ajax Click Twice in a Row Causes Content to disappear
- → OctoberCms component: How to display all ID(items) instead of sorting only one ID?
- → In OctoberCMS how do you find the hint path?
- → How to register middlewares in OctoberCMS plugin?
Ad