Reputation: 8419
SQL Fiddle Link (You can see my schema and data on above link)
I have three tables
1.register, 2.user_plan, 3.network
I have a trigger after insertion on user_plan. Insertion in network is done through this trigger
I have uid=4
in user_plan table
I have id=2
where right_mem=4
in register table
So I can not understand why
set userid=(select id from register where right_mem=my_userid);
This query gives me user_id = NULL
but I should get user_id= 2
Upvotes: 0
Views: 54
Reputation: 11588
You set the my_userid
variable to null a few lines up. Therefore your query is not looking for right_mem = 4
.
Upvotes: 1