#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    4
    Rep Power
    0

    Selecting from two tables


    Good day to you all.

    I have tables SUBJECT(subject_id, name, number) and PS(ps_id, subject_id, student_id). I need to select all from SUBJECT,subject_id and student_id from SP, joined by subject_id, where student_id needs to be read from session. I'm using asp.net with oracle database. Can anybody help me with the sql statement and how to get the value from the session.

    Thank you.
  2. #2
  3. Humble Learner
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2007
    Location
    Bangalore, India
    Posts
    280
    Rep Power
    120
    You can try something like this.

    select s.*, p.subject_id, p.student_id
    From subjects s, ps p
    where s.subject_id = p.subject_id
    and p.student_id in ("this is where you need to select you student_id from session")
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    4
    Rep Power
    0
    Thank you

IMN logo majestic logo threadwatch logo seochat tools logo