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

    Unanswered: Need help for mysql statement. urgent

    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
    Oct 2004
    Posts
    4
    ermz.. i manage to figure it out le.
    My new 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 <= 'B' AND r.module_code = m.module_code AND s.admin_no = r.admin_no";

    But now, my results wasn't in order.. can any one show me the syntax for sorting?
    Thanks a lot

  3. #3
    Join Date
    Oct 2004
    Posts
    4
    opps.. i solved it out again le.
    I use ORDER BY..
    Haha.. sorry for those who took your time viewing this...
    Cheers...

  4. #4
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    please do not post the same question in more than one forum

    see http://www.dbforums.com/t1051484.html
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

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