Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 SQL Query using Aqua Data Studio program

Author  Topic 

cpat258
Starting Member

3 Posts

Posted - 2012-11-10 : 17:48:55
I have executed three tables in my program. They are MOVIE, VIEWER and RATING. Within the MOVIE table i have MovieID, MovieTitle,IMDB_URL and a couple movie genres. With every MovieTitle there is a date(year only) in it. I have to list all the movies that have been released in 1982 and sort them in alphabetical order. I DO NOT have a release date field in this. However i found out the MovieID of movies. They are 89,214,228,414,423,440,527,629,632,638 and 674) All these MovieID were released in 1982. I came up with a code but it doesn't work. Can somebody help me out here? What am i doing wrong?

SELECT Movietitle FROM Movie WHERE MovieID=('89','214','228','414','423','440','527','629','632','638','674') ORDER BY MovieTitle ASC

Chirag Patel

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2012-11-10 : 18:17:28
Use IN instead of =

I doubt that's the query your instructor wants you to write though. We would need to see some sample data to help.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

cpat258
Starting Member

3 Posts

Posted - 2012-11-10 : 19:52:04
Thanks i got it. Im using wildcard in this

SELECT MovieTitle
FROM Movie
WHERE MovieTitle like '%(1982)'
ORDER BY MovieTitle ASC

Chirag Patel
Go to Top of Page
   

- Advertisement -