switching between different where selections inside the same select

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: El-Sherif (el_sherif_at_hotmail.com)
Date: 06/18/04


Date: Fri, 18 Jun 2004 17:32:41 +0200

Hi

    I Need To Know if there's away to use different where clauses in the
same select based on conditions , Inside My StoredProcedure

    like this

( THIS IS NOT A TRANSACT SQL- ACCEPTED STATMENT , IT ONLY REPRESENTS WHAT I
HAVE IN MIND)

    Select x,y,z
    from TABLEX

        if @condition1
            begin
                where x = 1
            end
        else
            begin
                where z = 1
            end

    order by z

Any Ideas , I wil Be Thankful

Anwar