ixxalnxxi
02-11-2008, 07:35 AM
so i like to keep code as effecient (short) as possible. that in mind, i'm using mysql 5.0
there is a query i am using that involves 3 tables, i was wondering how, if possible, is there a method to just use 1 query instead of 2 or 3?
tables:
users: userid
membership_plans: planid, plan, price, default
user_membership: planid, userid, active
what i want to do is something similar to
insert into user_memberships (planid, userid, active) values (planid*, userid*, active*)
planid* i'd liek to have the plan id received where default = 1 (for now, its only 1 entry where default = 1)
userid* i got this from an earlier mysql_select_id() function
active* will by default = 1 because the select id used by planid will pull plans with default = 1
any suggestions?
there is a query i am using that involves 3 tables, i was wondering how, if possible, is there a method to just use 1 query instead of 2 or 3?
tables:
users: userid
membership_plans: planid, plan, price, default
user_membership: planid, userid, active
what i want to do is something similar to
insert into user_memberships (planid, userid, active) values (planid*, userid*, active*)
planid* i'd liek to have the plan id received where default = 1 (for now, its only 1 entry where default = 1)
userid* i got this from an earlier mysql_select_id() function
active* will by default = 1 because the select id used by planid will pull plans with default = 1
any suggestions?