最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

按当前时间排序

SEO心得admin65浏览0评论
本文介绍了按当前时间排序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

大家好, 我在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.

发布评论

评论列表(0)

  1. 暂无评论