Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2004
    Posts
    4

    Unanswered: MySql statement help [urgently]

    Hi i need help here...
    My sql statement is
    $query = "SELECT * FROM ei_module m, ei_student s, ei_result r WHERE r.admin_no LIKE '". $adminno ."' AND r.exam_grade = 'A' AND r.module_code = m.module_code AND s.admin_no = r.admin_no";

    what i want to get is

    to display results with both Grade A or Grade B.
    but i could only get : Grade A but not Grade B
    Grade B but not Grade A
    what must i do to my mysql statement in order to get the desire result.
    Thanks for any kind soul who could help me with it.

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    SELECT * FROM ei_module m, ei_student s, ei_result r WHERE r.admin_no LIKE '". $adminno ."' AND r.exam_grade in ('A','B') AND r.module_code = m.module_code AND s.admin_no = r.admin_no
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Feb 2004
    Posts
    42
    Using * in a select statement takes longer to run due to more disk I/O than specifying the fields that you want. If you make extensive use of the * instead of specifying the fields in a query, you will notice a performance increase by specifying only the fields that you want to retrieve.

Posting Permissions

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