SQLTeam.com | Weblogs | Forums

"SQL command not properly ended"


#1

Hi,

Again seeking very novice advice for those willing to point out the basics. I have queried the following and I am still receiving the error. I check each of the first in a long list of User_SampleID individually and I receive back the expected rows.

select SAMPLES, POSITION, TYPE, LOCATION
from CONTAINER_SAMPLES where user_sampleid like ‘BOT2%PC%’,
or user_sampleid like 'BOT3%PC%'
or user_sampleid like 'BOT4%PC%';

  1. 00000 - "SQL command not properly ended"
    *Cause:
    *Action:
    Error at Line: 2 Column: 43

Another user has highlighted the use of OR maybe the obstacle but the issue is highlighted as Line 2.
Any assistance would be appreciated.

Regards


#2

You have a comma in the right/end place


#3

select SAMPLES, POSITION, TYPE, LOCATION
from CONTAINER_SAMPLES where user_sampleid like ‘BOT2%PC%’,
or user_sampleid like 'BOT3%PC%',
or user_sampleid like ‘BOT4%PC%’;

So for Line 2 my ending should be something else so the query can search for the second and third line sample data?


#4

Try this :

select SAMPLES, POSITION, TYPE, LOCATION
    from CONTAINER_SAMPLES where user_sampleid like ‘BOT2%PC%’
    or user_sampleid like ‘BOT3%PC%’
    or user_sampleid like ‘BOT4%PC%’;