I think this should be relatively straight forward.
I need to make a series of select statements. The 1st select statement pulls all the main goals for a person. The sub queries of that pull all the different data relavent to that goal.
So the first sql statement may be
create procedure getallgoals
@personid Integer
AS
Select GoalID, Goal, personid
From tbl_goal
where personid=@personid
NOw what I need to do is take that GoalID and use it for the rest of my sql statements....
Select timeid, Timeframe, months, weeks
from tbl_GoalTimetable
where GoalId=@GoalID
SELECT healthID, healthgoal
from tbl_GoalHealth
where GoalID=@GoalID
etc.
so there can be many Main goals, and each main goal can have multiple subgoals (so a person can have multiple health goals under the main goal of "Adopt a healthy lifestyle"- exercise daily/eat more fruit/etc
I need to make a series of select statements. The 1st select statement pulls all the main goals for a person. The sub queries of that pull all the different data relavent to that goal.
So the first sql statement may be
create procedure getallgoals
@personid Integer
AS
Select GoalID, Goal, personid
From tbl_goal
where personid=@personid
NOw what I need to do is take that GoalID and use it for the rest of my sql statements....
Select timeid, Timeframe, months, weeks
from tbl_GoalTimetable
where GoalId=@GoalID
SELECT healthID, healthgoal
from tbl_GoalHealth
where GoalID=@GoalID
etc.
so there can be many Main goals, and each main goal can have multiple subgoals (so a person can have multiple health goals under the main goal of "Adopt a healthy lifestyle"- exercise daily/eat more fruit/etc