SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Jan 2005
    Location
    london
    Posts
    46
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help in select statment

    hello i have three tables:

    tbl_student holding students details and tb_supervisor holding supervisors details and tbl_allocating holding students who will/are allocated.

    i just want to select the names of students who are 'Allocated' by supervisor id '3000'.

    key words: super_id = supervisors' id, stud_id: students id

    tables shown below:
    PHP Code:
    tbl_allocating
    +----------+---------+----------+----------+----------------+------------+
    alloc_id options stud_id  super_id allocated_flag date_today |
    +----------+---------+----------+----------+----------------+------------+
    |        
    |       22124401 |     3000 Allocated      2005-04-19 |
    |       
    37 |       45455656 |     2000 Rejected       2005-04-20 |
    |        
    |       |       93 |     1000 Allocated      2005-04-19 |
    |       
    11 |       |   793271 |     2000 Allocated      2005-04-19 |

    tbl_student:

    +----------+--------------+-----------+------------+------------------+----------------+
    stud_id  password     fname     lname      allocated_superv date_allocated |
    +----------+--------------+-----------+------------+------------------+----------------+
    22124401 jamaica123   Royan     Gooden     |             3000 2005-04-19     |
    |       
    93 ja           Ivy       Echebima   |             1000 2005-04-19     |
    |      
    222 bigman       Abdi      Razak      |             NULL 0000-00-00     

  2. #2
    Tranceoholic lilleman's Avatar
    Join Date
    Feb 2004
    Location
    Írebro, Sweden
    Posts
    2,716
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    Perhaps a query like this one can do the trick?

    Code:
    SELECT s.fname, s.lname
    FROM tbl_allocating as a
      INNER JOIN tbl_student as s
        ON s.student_id = a.stud_id
    WHERE a.super_id = 3000
    (If you want the student's full name in one field, use CONCAT.)
    ERIK RIKLUND :: Yes, I've been gone quite a while.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •