Select to view content in your preferred language

Turn off a selected Label in SQL Query ?

2253
7
03-08-2017 01:47 PM
PROBERT68
Honored Contributor

Hello ,

I am working on this Damn it Highways layer and I need to selected some labels for some of the highways. One of them I need to "turn it off" but it would not let me to.

I have this map that I am working on and is for to put on the webpage later.  

That label I-25  I drew the red circle the lower right bottom of the map   in Southwestern Kansas I need that to turn off but leave the road on. It would not turn it off. 

Why doesn't my SQL query not working ?  

0 Kudos
7 Replies
DarrenWiens2
MVP Honored Contributor

I take it that feature you want to remove the label from is "FID" = 321?

0 Kudos
PROBERT68
Honored Contributor

After I posted it here, I played it around  a little bit and decide to flipped the expression like this:

"FID" <> 321 AND "HWY_SYMBOL" = '25' OR "HWY_SYMBOL" = '70' 

that worked ! That I-25 Label now disappear !

0 Kudos
DarrenWiens2
MVP Honored Contributor

I suspect it's just a matter of how the SQL interprets the grouping of your terms, which is why you should always force your grouping with parentheses. I suspect in your original attempt ("HWY_SYMBOL" = '25' OR "HWY_SYMBOL" = '70' AND "FID" <> 321), it was interpreted as:

"HWY_SYMBOL" = '25' OR ("HWY_SYMBOL" = '70' AND "FID" <> 321)

Since FID=321 is HWY_SYMBOL='25', all labels will show.

I think you could change your original to the following:

("HWY_SYMBOL" = '25' OR "HWY_SYMBOL" = '70') AND "FID" <> 321

This will first filter the HWY_SYMBOL to either '25' or '70', and from those, remove FID=321.

PROBERT68
Honored Contributor

I tried to put parentheses on the first expression before the OR and didn't work so  my expression wasn't right. So, that is why I move the FID <> 321 at the beginning of the expression and then insert the HWY_SYMBOL = 25 or HWY_SYMBOL = 70. after the AND.

0 Kudos
AbdullahAnter
Honored Contributor

Are you sure that you have this values in the field?

could you identify the road before create the SQL expression to know what the value you need ?

0 Kudos
PROBERT68
Honored Contributor

Not sure what you mean ?

0 Kudos
PROBERT68
Honored Contributor

It is not the value  it is the Feature Identifier that I want to turn it off ...

0 Kudos