Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 IF and Only IF

Author  Topic 

goligol
Posting Yak Master

128 Posts

Posted - 2011-07-11 : 10:41:31
Hi,

I would like to write the following commnad:

where
(left(A.geo_orig,1) <> 'E' IF AND ONLY IF (right (B.geo_dest,1) = 0 or B.geo_dest ='001'))

I do not have any idea how to consider the "if and only if"

Thank you

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2011-07-11 : 10:49:52
where
left(A.geo_orig,1) <> 'E' AND (right(B.geo_dest,1) = 0 OR B.geo_dest ='001')


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

goligol
Posting Yak Master

128 Posts

Posted - 2011-07-11 : 11:12:07
Thank you
Go to Top of Page

goligol
Posting Yak Master

128 Posts

Posted - 2011-07-11 : 14:42:44
Hi, this command will not show any A.geo_orig where their left are "E".
What I want is
left(A.geo_orig,1) <> 'E' when (right(B.geo_dest,1) = 0 OR B.geo_dest ='001')

otherwise show the
left(A.geo_orig,1) ='E'

Thank you
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2011-07-11 : 14:47:45
where left(A.geo_orig,1) = 'E' OR right(B.geo_dest,1) = '0' OR B.geo_dest ='001'
Go to Top of Page

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2011-07-11 : 17:41:41
quote:
Originally posted by goligol

Hi, this command will not show any A.geo_orig where their left are "E".
What I want is
left(A.geo_orig,1) <> 'E' when (right(B.geo_dest,1) = 0 OR B.geo_dest ='001')

otherwise show the
left(A.geo_orig,1) ='E'


where 
left(A.geo_orig,1) = 'E'
OR
(
left(A.geo_orig,1) <> 'E'
AND
(
right(B.geo_dest,1) = '0'
OR B.geo_dest ='001'
)
)
Go to Top of Page

goligol
Posting Yak Master

128 Posts

Posted - 2011-07-12 : 10:43:25
Thank you thank you thank you.
Go to Top of Page
   

- Advertisement -