July 10, 2014 at 5:28 am
select mvID, title, rating, length ,studio
from MovieInfo
where rating not like 'R'
and
where (length > 90)
Seems to be a problem with line 5
Thanks in Advance.
July 10, 2014 at 5:34 am
cstrati (7/10/2014)
select mvID, title, rating, length ,studiofrom MovieInfo
where rating not like 'R'
and
where (length > 90)
Seems to be a problem with line 5
Thanks in Advance.
Query should be
select mvID, title, rating, length ,studio
from MovieInfo
where rating not like 'R'
AND (length > 90)
Thanks
July 10, 2014 at 5:34 am
Edit because I missed the obvious problem.
How to post a question to get the most help http://www.sqlservercentral.com/articles/Best+Practices/61537
July 10, 2014 at 5:34 am
Hi, just remove the second 'where'.
Only 1 where per select in a query - combine conditions using and/or
July 10, 2014 at 5:36 am
cstrati (7/10/2014)
select mvID, title, rating, length ,studiofrom MovieInfo
where rating not like 'R'
and
where (length > 90)
Seems to be a problem with line 5
Thanks in Advance.
There may be a problem with line 2 also. Do you mean
WHERE rating NOT LIKE 'R%'
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
July 10, 2014 at 6:45 am
Without the wild card on the comparison to 'R' you might as well drop the LIKE statement and say <> instead.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply