TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Kavi suja
NA
298
171.1k
MySql - Data From 3 tables -Left Joins
Jul 16 2013 3:55 AM
Hi,
I have to retrieve data from 3 tables usind common id.I include the SP following.Here i have whosinfo table.This tables contains 2 fields,pkey and hisPkey.It stores the common id as hispkey.In this procedure i've to check continfo.whosinfo_pkey=whos.pkey for mobile number taken from contactinfo table.I want to use subquery here.But there are some errors.I dont know how to apply sub query.Can anyone helps me to solve this?
CREATE DEFINER=`root`@`%` PROCEDURE `SP_EditDoct`(in DID int)
BEGIN
SELECT
Dept.Deptid,
DoctInfo.SalutationList_pkey,
DoctInfo.firstname,
DoctInfo.middleinitial,
DoctInfo.lastname,
DATE_FORMAT(DoctInfo.dateofbirth,'%m/%d/%Y'),
DoctInfo.education,DoctInfo.Speciality,
DoctInfo.gender,ContInfo.value as MobileNo
FROM
commonpersoninfo DoctInfo
LEFT JOIN
contactinfo ContInfo ON DoctInfo.pkey=ContInfo.whosInfo_pkey
INNER JOIN
departmentview Dept ON DoctInfo.pkey=Dept.CommonPersonInfo_Pkey
/* INNER JOIN whosinfo Whos ON ContInfo.whosInfo_pkey = Whos.hisPkey*/
WHERE
DoctInfo.pkey=DID;
END
Reply
Answers (
11
)
how to calculate grand total from total column in gridview?
how to store value in variable from store procedure?