May 13, 2003 at 2:47 pm
need help with store procedure...
have 3 tbls.
tblComp(PK CompId(int 4), compName, dateCreat(datetime 8)--no null)
tblContact [PK contId(int 4),{fk} compId(int 4), Name, MemoCount(int 4), dateEnter(datetime 8)--no null]
tblMemo[pk memoId (int 4), {FK} contId(int 4), {FK} compId (int 4), memo (varchar 100)]
Need to Write a stored procedure that takes a parameter of a compId. It then retrieves the company record, any contact records associated with the company, any memo associated with the company, and any memo associated with the contacts. The stored procedure returns four result sets (company record, contact records, memo associated with company, and memo associated with contacts). For the memo result sets, have to make sure records are listed once and only once.
thanks
mat..
May 13, 2003 at 9:36 pm
You want this all in 1 returned recordset? I'd recommend a union. The first select gets the company contacts and company memos. Then select the memos associated with the contacts in the 2nd query.
Darren
Darren
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply