Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2004
    Posts
    2

    Unanswered: Search and Results using multiple columns

    I have a DBTable named Vendors which includes the following columns: CompanyName (Name Here)
    SBI (Yes, No)
    MBE (Yes, No)
    SBI (Yes, No)
    WBE (Yes, No)

    I'm trying to do a search on Vendors where either SBI or MBE or SBI or WBE is equal to 'yes' and then order by company name.

    I'm lost on both the search and the results code.

    I'd like to have a drop down for the search like this:

    <form name="Search" action="vendor_results.asp" method="post">
    <Input type=hidden name="validate" value=1>

    Show all Vendors who are: <Select name="?????">
    <OPTION value="YES">SBI
    <OPTION value="YES">SBE
    <OPTION value="Yes">MBE
    <OPTION value="Yes">WBE
    </select>
    <Input type="submit" Value="Go">
    </form>


    Any ideas on how to make this work would be greatly appreciated.

  2. #2
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322

    Re: Search and Results using multiple columns

    Originally posted by graham2004
    I'm trying to do a search on Vendors where either SBI or MBE or SBI or WBE is equal to 'yes' and then order by company name.
    Huh?


    I'm lost on both the search and the results code.
    Me too....

    Want to post the table DDL and some sample INSERTS in to that table, and then describe what the result set should be...
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  3. #3
    Join Date
    Nov 2003
    Location
    Romania
    Posts
    70
    SELECT CompanyName FROM Vendors
    WHERE SBI = YES OR SBE = YES OR MBE = YES OR WBE = YES
    ORDER BY CompanyName

    or use -1 inside of YES

    I don't now if you want this

  4. #4
    Join Date
    Feb 2004
    Posts
    2
    Hi - i tried your example but I don't think I am asking correctly. Here is the results code i am trying to use based on that drop down menu i gave before (for "name" where i have ????? i am using SBI, but I know this is wrong, I need more than one)

    elseif request("validate")=1 then
    strSBI=request("SBI")
    strWhere="Where SBI = '%" & strSBI & "%' or SBE = '%" & strSBE & "%' Order by CompanyName"

    strSQL = "SELECT Companyname FROM Vendors Where WHERE SBI = 'YES' OR SBE = 'YES' OR MBE = 'YES' OR WBE = 'YES' ORDER BY CompanyName "
    Set rsCount = conn.Execute(strSQL)
    ReportOnError("Error")

Posting Permissions

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