Search select statement

Posted by Nana on Stack Overflow See other posts from Stack Overflow or by Nana
Published on 2009-11-01T02:02:24Z Indexed on 2010/04/02 20:03 UTC
Read the original article Hit count: 387

Filed under:
|
|

I am creating a page which would have different field for the user to search from. e.g. search by:

  • Grade: -dropdownlist1-
  • Student name: -dropdownlist2-
  • Student ID: -dropdownlist3-
  • Lessons: -dropdownlist4-
  • Year: -dropdownlist5-

How do I write the select statement for this? Each dropdownlist would need a select statement which would extract out different data from the database.

But, I want to write ONE select statement which can dynamically choose the dropdownlist options. Instead of writing many many select statement.

Lets say;

  • Grade: -dropdownlist1- ; default value(all)
  • Student name: -dropdownlist2-; default value(all)
  • Student ID: -dropdownlist3-; 0-100 is choosen
  • Lessons: -dropdownlist4-; A-C is choosen
  • Year: -dropdownlist5-; 2009 is choosen

© Stack Overflow or respective owner

Related posts about sql

Related posts about statement