Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4573958
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T19:51:27+00:00 2026-05-21T19:51:27+00:00

I am stuck trying to combine a like with a left join in Sybase.

  • 0

I am stuck trying to combine a like with a left join in Sybase.

For example (although in my case it’s a bit more complicated), I am looking for text that neither contains an o nor an i.

I am able to do the opposite, that is, text containing either of these letters:

select numbers.name from 
(
      select 'one'   name union all
      select 'two'   name union all
      select 'three' name union all -- neither %o% nor %i%
      select 'four'  name union all
      select 'five'  name union all
      select 'six'   name union all
      select 'seven' name union all -- neither %o% nor %i%
      select 'eight' name union all
      select 'nine'  name union all
      select 'ten'   name           -- neither %o% nor %i%
) numbers,
(
      select '%o%'  expression union all
      select '%i%'  expression       
) patterns
where
  numbers.name like patterns.expression

selects all records except three, seven and ten as expected.

Now, I am looking for a way to find these three records. I thought about left joining numbers with patterns and then filtering on the expression being null. Something like this:

numbers.name *like patterns.expression and
patterns.expression is null

Obviously, this doesn’t work. So, I’d be happy for any pointer given into the right direction.

For what’s its worth, this is the version I am working on:

select @@version
'Adaptive Server Enterprise/15.0.3/EBF 17156 ESD#3/P/Sun_svr4/OS 5.8/ase1503/2726/64-bit/FBO/Fri Feb  5 05:26:23 2010'
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T19:51:27+00:00Added an answer on May 21, 2026 at 7:51 pm

    You should use NOT EXISTS (it’s the case):

    select numbers.name from 
    (
          select 'one'   name union all
          select 'two'   name union all
          select 'three' name union all -- neither %o% nor %i%
          select 'four'  name union all
          select 'five'  name union all
          select 'six'   name union all
          select 'seven' name union all -- neither %o% nor %i%
          select 'eight' name union all
          select 'nine'  name union all
          select 'ten'   name           -- neither %o% nor %i%
    ) numbers
    where not exists (select null
                        from (
                                 select '%o%'  expression union all
                                 select '%i%'  expression
                             ) patterns
                       where numbers.name like patterns.expression)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm kind of like stuck trying to implement YUI autocomplete textbox. here's the code:
I'm kind of stuck trying to code an example of file transfer using libpurple.
I have a text file which I'm trying to parse. The file looks like
I'm a bit stuck trying to loop through a table row, calculate the values
I'm a bit stuck trying to get my code to output correctly, see below.
I'm a bit stuck trying to figure out how to design an Oracle query,
I've been stuck trying to figure out why a counter cache on my (parent)
Sometimes I still get stuck trying to translate procedural code into functional code. Is
I'm stuck trying to get a WinInet HTTP POST via SSL using ONLY C.
I've been stuck trying to arrive at a best solution for this for a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.