Please be aware that the SAP SQL Anywhere Forum will be shut down on August 29th, 2024 when all it's content will be migrated to the SAP Community.

I have some sql like

Select * 
from bti.table
field between start and stop
and field1 is null
and (field2 like 'HH%' or field2 like 'HS%' or field2 like 'SS%')

I only get results like HH%. What gives? Is there an alternate way to do this? I could make 3 separate queries and combine the results but that would be slow and clunky.

version is


asked 29 Aug '18, 14:31

josephcraw's gravatar image

accept rate: 100%

edited 29 Aug '18, 15:16

I cannot reproduce that behavior. Please confirm the version and build you are testing. I tested the following query against the demo database:

select * from employees where StartDate between '1900-01-01' and '2019-01-10' and TerminationDate is null and (City like 'CH%' or City like 'CO%' or City like 'WA%')

In the results, I get the following cities: Charlottetown, Cornwall, Wakefield, Waterdown, and Waterloo

(29 Aug '18, 14:51) Chris Keating

version is

(29 Aug '18, 15:16) josephcraw

I'm an idiot. The issue was there was nothing that met the criteria for the other likes. Sorry

permanent link

answered 29 Aug '18, 15:25

josephcraw's gravatar image

accept rate: 100%


Don't worry about it... you did the right thing by posting a question, sometimes that's the path to epiphany :)

(29 Aug '18, 16:11) Breck Carter
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 29 Aug '18, 14:31

question was seen: 1,021 times

last updated: 29 Aug '18, 16:12