大家好, 我在sql中按时间遇到问题顺序 我的问题是订购应从当前时间开始. 将填充所有值,但第一个值将是当前时间". 以下是我的查询 -----------------------------------
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
推荐答案出了什么问题?使用订购依据 [ ^ ]子句. What''s the problem? Use Order by[^] clause.
您的问题不是很清楚.尝试改善问题并以真实的言语告诉我们您在做什么. 猜想看,您似乎正在尝试显示电视节目的信息.如果您只想查看当前正在播放的节目,则可能要使用WHERE子句并过滤数据以仅提取当前正在运行的节目的记录.如果您真的在要求排序帮助...那又是什么呢?您可以使用解决方案1中建议的Manas Bhardwaj的排序依据,按Air_date字段进行排序.但是,如果您的数据包含将来的情节记录,这些记录也会显示.这完全取决于您未在问题中提供的详细信息. 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.