Click here to Skip to main content
15,949,741 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi All,
I am facing a problem order by time in sql

My problem is the ordering should start from Current time.
All value will populate but the 1st value will be Current time.

Below is my query
-----------------------------------
select b.E_Episode_AirTime, a.*,b.*,c.*,c.e_episodeAirDate as AirDate,c.e_episodeAirTime 
	as AirTime,substring(a.E_Episode_Overview,0,100) as e_overv     /*substring to describe the character or binary text  */
	from EpisodeMaster a inner join
	EpisodeDetails b on a.E_Episode_Id=b.E_Episode_Id  	 
	
	inner join EpisodeMoreDetails c on
	a.E_Episode_Id = c.E_Episode_Id
	
	and convert(varchar, b.E_Episode_AirDate, 111)= convert(varchar, getdate(), 111) 	
	and a.IsActive = 1

Please help
Thanks in advance
Posted

What's the problem? Use Order by[^] clause.
 
Share this answer
 
Comments
Dalek Dave 15-Sep-11 15:41pm    
Good Answer.
Manas Bhardwaj 16-Sep-11 6:06am    
Thanks!
Your question is not very clear. Try Improving the Question and telling us in real words what you are doing.

As a guess, it looks like you are trying to show information for television shows. If you only want to see shows that are airing at the current time, then you probably want to use the WHERE clause and filter your data to only pull the records for shows that are running right now. If you are really asking for sorting help...then for what? You can sort by your Air_date field using the Order By that Manas Bhardwaj suggested in Solution 1. But if your data contains records for episodes in the future, those will display as well. It all depends on details that you haven't provided in your question.
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900