Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2015
    Posts
    31

    Answered: like with a catalog table

    Hello ,
    I have two tables , the first one is "address " and the second one contains "swear" words.
    What I have to do is when the field address contains a "swear" word , then I have to blank the output

    select
    A.address
    from
    table_address A
    table_swear B
    where
    A.address not like '%field_swear_word%"

    I hope to be clear ,
    thank you -

  2. Best Answer
    Posted by mark.b

    "Hello,

    try this:
    Code:
    with 
      table_address (address) as (values 'word1', 'word2 word3', 'word4')
    , table_swear (field_swear_word) as (values 'word1', 'word2')
    select case when exists (select 1 from table_swear B where A.address like '%'||B.field_swear_word||'%') then '' else A.address end
    from table_address A
    "


  3. #2
    Join Date
    Dec 2007
    Location
    Richmond, VA
    Posts
    1,328
    Provided Answers: 5
    do you mean the fact that I live on Blue Ball Rd. might offend someone and therefore you don't want to show my address? Funny. There have been many examples of similar type requirement(not for this purpose mind you) but finding a column within a column. you can use the search feature to find them.
    Dave

  4. #3
    Join Date
    Mar 2015
    Posts
    31
    Quote Originally Posted by dav1mo View Post
    do you mean the fact that I live on Blue Ball Rd. might offend someone and therefore you don't want to show my address? Funny. There have been many examples of similar type requirement(not for this purpose mind you) but finding a column within a column. you can use the search feature to find them.

    Hello , do you have an exemple of this search feature ?
    Thank You -

  5. #4
    Join Date
    Jul 2013
    Location
    Moscow, Russia
    Posts
    666
    Provided Answers: 55
    Hello,

    try this:
    Code:
    with 
      table_address (address) as (values 'word1', 'word2 word3', 'word4')
    , table_swear (field_swear_word) as (values 'word1', 'word2')
    select case when exists (select 1 from table_swear B where A.address like '%'||B.field_swear_word||'%') then '' else A.address end
    from table_address A
    Regards,
    Mark.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •