UPDATE/SET/REPLACE with multiple criteria

  • I need to update the value of a field ("Category") according to the contents of another field in the same table ("Typewrit"). I've done this already a million times using a single criteria, but the next step involves having Category look at two different criteria and it's arguing with me. My first thought was:

    use CIVIL

    Update Receipts

    Set CATEGORY='NON' where TYPEWRIT LIKE '%SUBPOENA%' AND TYPEWRIT <> '%VIOLENCE%'

    Basically, i need to set the value of Category to 'NON' when the word "SUBPOENA' DOES appear in typewrit and the word 'VIOLENCE' does NOT appear in that column. Category is a Varchar(3) and Typewrit is a damn TEXT field. Given i'm not trying to change the value in Typewrit, why would i need to cast this column to make this comparison? Also, is there anything wrong with my syntax here other than the need to Cast the Typewrit field?

    thanks

  • In your example, use "NOT LIKE" instead of "<>".

    Does this correct the issue?

  • Bingo. Ugh. Thanks.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply