2 MMColParam's One for id One for session variable

Posted on 2006-04-22
Last Modified: 2009-07-29
I am trying to get a recordset to filter based on either or parameter:

FROM dbo.Users  WHERE UserEmail = 'MMColParam' AND
WHERE UserEmail = 'MMColParam2'

MMColParam             1                Session("svusername")
MMColParam2           1                 Request.Querystrint("id")
Question by:vonfranzken
    1 Comment
    LVL 70

    Accepted Solution

    Hi vonfranzken,

    Why use AND when you state in your question it's either/OR?

    SELECT *FROM dbo.Users  WHERE UserEmail = 'MMColParam' OR WHERE UserEmail = 'MMColParam2'

    In any event, you cannot use AND to limit on the same column.  By definition, the value in any given row's column is unqiue to that row.  The UserEmail can only be one value at a time for the row but an AND condition forces it to be two values at once in order for the condition to be true.

    SELECT * FROM dbo.Users WHERE UserEmail = AND UserEmail = is an impossible condition.  It can never be true for any one row.

    This will pull any row that matches either side of the condition:

    SELECT * FROM dbo.Users WHERE UserEmail = OR UserEmail =

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Join & Write a Comment

    For those who don't know, Adobe Dreamweaver is a popular commercial web editor that enables you to design, build and manage complex websites. The editor is a WYSIWYG (What You See Is What You Get) web editor, which means that you can create your web…
    I still run into .cgi files every now and then. In some instances, I actually prefer the simplicity of a .cgi script to other options. Since I use DreamWeaver extensively, what I needed was a way to open .cgi scripts in Dreamweaver. And I wanted to …
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now