Click here to Skip to main content
12,767,912 members (44,325 online)
Rate this:
 
Please Sign up or sign in to vote.
-- =============================================
-- Author:      <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
ALTER Procedure GetNowShowingMovies
AS
select distinct(m.MovieName+' ('+m.Language+')') as MovieWithLanguage,m.*  from Movies m inner join
MovieTimings mt on mt.MovieID = m.MovieID and
 m.Active = 1  and convert(varchar,mt.Date,112) >= convert(varchar,getdate(),112)  where mt.Active = 1
and convert(varchar,getdate(),112)>=convert(varchar,m.ReleaseDate,112)


[edit]Code block fixed - OriginalGriff[/edit]
Posted 14-Jan-13 22:36pm
varun1501.1K
Updated 14-Jan-13 22:47pm
v2

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

This seems half query, you have forgotten to put in actual date.

Anyway, this is giving you movie details from first table (Movies) with date greater than given date (which you have missed in the code in your post). This date should be in yymmdd format i.e. convert(varchar,mt.Date,112) > 20130115

Hope that helps. If it does, mark it as answer/upvote.
Milind
  Permalink  
Comments
OriginalGriff 15-Jan-13 3:48am
   
The date portion was swallowed by the HTML - fixed now.
Milind_T 15-Jan-13 3:50am
   
Great, I would never have guesssed and blame OP only !
OriginalGriff 15-Jan-13 3:57am
   
:laugh: It happens far too often!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web01 | 2.8.170217.1 | Last Updated 15 Jan 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100