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
Toh Zuan Yi
NA
19
24.1k
SQL statement
Aug 16 2011 1:19 AM
Hiii ppl =] I want to ask a question of how to write a SQL statement.
The Scenario goes like this.
The Doctor can upload videos, and the patients that are assigned to him can see those videos. I have a ClinicianPatientAssignment table, where the columns are PatientID and ClinicianID. There are a number of clinicians, and each clinician with a number of patients. I also have a Users table, where all users are inside of it containing their UserID, name, contact number etc but i just need the userID from that table. On My Videos table, i have userID and videoID and other information. My original SQL statement was like this.
"SELECT A.*
FROM Videos A
INNER JOIN ClinicianPatientsAssignment B
ON A.UserID = B.ClinicianID
INNER JOIN Users C
ON B.PatientID = C.UserID
WHERE B.UserID = " +userID
"ORDER BY A.DateCreated DESC"
i got the video information according to the UserID in video table which is = to ClinicianID in ClinicianPatientsAssignment. then i got the userID from the aspx page and store it in B.UserID which is the PatientID in ClinicianPatientsAssignment. Am i doing this the correct way? And other thing is i need to know how to connect the patientID to ClinicianID like IF the Patient is under ClinicianID=3 then display all videos from clinicianID=3. Can anyone help me Fast D:
Reply
Answers (
3
)
SQLite Database Browser
View more than 2000 rows