WHERE without using CASE

Status
Not open for further replies.
M

Mark B

I'm trying to edit a Filter in Outlook and it has a sort of SQL syntax. The

only thing is I don't know if it accepts CASE statements -- it's giving a

'SQL parsing' error.

Is there another simple SQL way of doing this WHERE clause without using

case (e.g. using AND or OR)?:

WHERE (CASE WHEN (MyField1 IS NULL) THEN (MyField2) ELSE (MyField1))>1

My Reference:

(CASE WHEN

("http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/MyField1"

IS NULL) THEN

("http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/MyField2")

ELSE

("http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/MyField1"))>1
 
M

Mark B

Think I may have it:

WHERE

(MyField1>1 AND MyField2 IS NULL)

OR

((MyField2 IS NOT NULL) AND MyField2>1)

"Mark B" <none123@none.com> wrote in message

news:OLum1c6mKHA.4436@TK2MSFTNGP02.phx.gbl...
> I'm trying to edit a Filter in Outlook and it has a sort of SQL syntax.
> The only thing is I don't know if it accepts CASE statements -- it's
> giving a 'SQL parsing' error.

> Is there another simple SQL way of doing this WHERE clause without using
> case (e.g. using AND or OR)?:

> WHERE (CASE WHEN (MyField1 IS NULL) THEN (MyField2) ELSE (MyField1))>1

> My Reference:

> (CASE WHEN
> ("http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/MyField1"
> IS NULL) THEN
> ("http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/MyField2")
> ELSE
> ("http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/MyField1"))>1
 
T

Tom Cooper

You could do

0WHERE MyField1 > 1 OR

(MyField1 Is Null AND MyField2 > 1)

Tom

"Mark B" <none123@none.com> wrote in message

news:OLum1c6mKHA.4436@TK2MSFTNGP02.phx.gbl...
> I'm trying to edit a Filter in Outlook and it has a sort of SQL syntax.
> The only thing is I don't know if it accepts CASE statements -- it's
> giving a 'SQL parsing' error.

> Is there another simple SQL way of doing this WHERE clause without using
> case (e.g. using AND or OR)?:

> WHERE (CASE WHEN (MyField1 IS NULL) THEN (MyField2) ELSE (MyField1))>1

> My Reference:

> (CASE WHEN
> ("http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/MyField1"
> IS NULL) THEN
> ("http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/MyField2")
> ELSE
> ("http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/MyField1"))>1
 
M

Mark B

Thanks.

"Tom Cooper" <tomcooper@comcast.net> wrote in message

news:OXdDxj6mKHA.5520@TK2MSFTNGP05.phx.gbl...
> You could do

> 0WHERE MyField1 > 1 OR
> (MyField1 Is Null AND MyField2 > 1)

> Tom

> "Mark B" <none123@none.com> wrote in message
> news:OLum1c6mKHA.4436@TK2MSFTNGP02.phx.gbl...
> > I'm trying to edit a Filter in Outlook and it has a sort of SQL syntax.
> > The only thing is I don't know if it accepts CASE statements -- it's
> > giving a 'SQL parsing' error.
>

>> Is there another simple SQL way of doing this WHERE clause without using
> > case (e.g. using AND or OR)?:
>

>> WHERE (CASE WHEN (MyField1 IS NULL) THEN (MyField2) ELSE (MyField1))>1
>

>
>
>
>
>
>
>
>
>
>
>
>
>> My Reference:
>

>> (CASE WHEN
> > ("http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/MyField1"
> > IS NULL) THEN
> > ("http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/MyField2")
> > ELSE
> > ("http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/MyField1"))>1

>
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
e_a_g_l_e_p_i Changing where data .pst is saved to Using Outlook 3
D Anyone tell me where custom view settings are stored? Outlook VBA and Custom Forms 9
P Sending email from outlook IMAP to GMAIL where embedded images are added as attachment Using Outlook 1
J Outlook 2016 After a search in all mailboxes, where is each message that was found? Using Outlook 6
M Where is the setting to *turn off* open calendar in a new window? Using Outlook 3
J OUTLOOK 2016 FILE STORAGE WHERE COMMAND Using Outlook 12
C Long List Of Outlook 2016/Outlook.com Bugs // Where To Report? Using Outlook 10
S Views ans Where Settings AreSavd Using Outlook 4
F Move mails from Deleted Items folder back to its original folder where the mails got deleted Using Outlook 0
N Wishlist Opening Outlook where we left off Outlook Wishlist 0
Horsepower Where did Evenote come from? Using Outlook 6
tswatek Issue with where Outlook saves new contacts Using Outlook 3
snissen Where is "Edit Message" in Outlook 2016? Using Outlook 2
C Where are BCM User Customizations located? BCM (Business Contact Manager) 9
Mark Foley Where are Outlook categories save for IMAP? Using Outlook 12
T Where did my categorized emails go? Using Outlook 1
H Where to post code in Outlook Outlook VBA and Custom Forms 1
R click to toggle quick click category reasigns to where ? Using Outlook 2
P Where are the cached emails stored? Using Outlook.com accounts in Outlook 2
D VBA Script (Ask to where to save send mail) Outlook VBA and Custom Forms 1
R Outlook 2013 People Pane - Where is the "Add" button for social networks? Using Outlook 4
J Lost contacts.pst afer sync with iCloud: where has contact.pst disapperaed to? Using Outlook 3
O Outlook 2013 contacts - Where to find "Display as"-field Using Outlook 2
J Linking Contacts to a Message Where the Contact isn't an Addressee Using Outlook 1
L How do i choose where i file my sent messages? Using Outlook 1
C Outlook 2007 Contact Card opens in margin of screen where I can't see it Using Outlook 3
P Where the heck is the data? Using Outlook 10
G Modify Subject line of incoming mail where I am in Cc line Using Outlook 1
B Can't locate in Outlook custom form where is message from Using Outlook 4
B help: where are outlook2000 email accounts stored Using Outlook 14
Rupert Dragwater Where to find folders in Outlook 2010 Using Outlook 4
S Where is the BCM SDK?? BCM (Business Contact Manager) 1
B Where are my emails that I already? Using Outlook 1
G Where are Saved Reports physically stored? BCM (Business Contact Manager) 0
O Where is Launcher, the custom action for Exchange server? Exchange Server Administration 1
J Where is Final Release BCM 2010, Microsoft? Why is Dev Team silent BCM (Business Contact Manager) 2
B Where is RTM version of BCM 2010? BCM (Business Contact Manager) 2
N Where have all the helpful people gone in this forum? BCM (Business Contact Manager) 3
S Custom Fields - Deleting And Where Are They Saved Outlook VBA and Custom Forms 8
S Where to publish my custom form ? Outlook VBA and Custom Forms 4
P Where are User-defined fields stored in BCM 2010 database? BCM (Business Contact Manager) 2
E Where is Business Contact Manager?? BCM (Business Contact Manager) 2
T Where is "administrative groups" Exchange Server Administration 9
D Where does Outlook store signatures? Outlook VBA and Custom Forms 9
K Get folder path where an account stores messages Outlook VBA and Custom Forms 5
A COM add-in causes Outlook 2007 to periodically crash where it did not in Outlook 2003 Outlook VBA and Custom Forms 3
1 Where Can I get hold of a copy of Business Contact Manager BCM (Business Contact Manager) 4
E Where is the best place to store values for combobox entries Outlook VBA and Custom Forms 5
E Where is the best place to store values for combobox entries Outlook VBA and Custom Forms 5
H Where does Outlook 2007 save the default reminder settings? Outlook VBA and Custom Forms 1

Similar threads

Top