Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2005
    Posts
    7

    Question Unanswered: Unique SQL issue using a wildcard in my where statement

    Does anyone know how I could possibly ise a wildcard in my SQL statement similar to:

    select Person from Table where Users=*

    Now I know you are probably saying well why not use either:
    select Person from Table
    or
    select Person from Table where Person like "%%"

    The reason is this:
    My program is feeding off a HUGE amount of data. I am using about 12 dropdown menus which all are column names in a View. I have all drop downs dependant on each other and have stored procedures feeding in the varibles from the dropdown menus. So I am great if a user selects 1 item off the dropdown list but I also want to give them the option to view all. So that is my problem. I could build the SQL query on the fly and execute it within the script but that would take a great deal of work and tons more processing time.

    So example: if the user selects a variable from menu 1 great all subsequent dropdowns populate but if they want to see all items pertaining to dropdown 2 then the where clause in the stored procedure never executes due to no variable (or a *) being fed in. My best bet is to find some sort of wildcard that i could utilize with the "where =" operator and not build on the fly statements. At this point I really don't think it exists but I thought I would ask the experts before totaly giving up and testing the processing time for a "build on the fly" scenaro.

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    ... where 1=1 and ...
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Feb 2005
    Posts
    7
    OMG...Thank you, Thank you, Thank you! That was so simple and perfect!

Posting Permissions

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