如何使用Varchar(10)格式mm / dd / yyyy之间查询日期范围(How to query date range using between in Varchar(10) format mm/dd/yyyy)
我试图只显示“DateDue”在去年内的记录。 问题是我的日期是Varchar(10)的格式,因为我的数据源是从供应商那里进入我的数据库的。 显然,使用此查询未正确过滤日期。 是否可以将此(为了比较日期范围而临时)转换为在查询中使用的正确日期数据类型,但不能永久地更改该列的类型?
SELECT `DocNum`, `DateDue` FROM `prod_po_list` WHERE `DateDue` BETWEEN (DATE_FORMAT(curdate( ) - INTERVAL 365 DAY , '%m/%d/%Y' )) AND DATE_FORMAT( CURDATE( ) , '%m/%d/%Y' )
I am trying to only show records where "DateDue" is within the last year. The trouble is my date is in the format of Varchar(10) as a result of my data feeds coming into my database on intervals from a vendor. Obviously, the dates are not being filtered properly using this query. Is it possible to convert this (temporarily for sake of comparing the date range) to the proper date data type for use in the query, but not permanently alter the type for that column?
SELECT `DocNum`, `DateDue` FROM `prod_po_list` WHERE `DateDue` BETWEEN (DATE_FORMAT(curdate( ) - INTERVAL 365 DAY , '%m/%d/%Y' )) AND DATE_FORMAT( CURDATE( ) , '%m/%d/%Y' )
原文:
最满意答案
您应该使用JQuery AJAX请求 。 这是一个简单的例子:
$.ajax({ type: "POST", url: "your-web-service-url-here.php", //Optional data to send to the service. data: { name: "John", location: "Boston" } }).done(function( msg ) { //This is the JSON message received from the service. alert( "Data Saved: " + msg ); });
希望这可以帮助。
You should use a JQuery AJAX request. Here is an simple example:
$.ajax({ type: "POST", url: "your-web-service-url-here.php", //Optional data to send to the service. data: { name: "John", location: "Boston" } }).done(function( msg ) { //This is the JSON message received from the service. alert( "Data Saved: " + msg ); });
Hope this helps.
相关问答
更多-
Web服务与Web应用程序(Web Service vs Web Application)[2023-05-31]
在低层次上,Web应用程序和Web服务有点相同。 它们都通过http(s)进行操作。 SOAP只是一个明确定义的XML版本。 REST只是HTTP。 如果你愿意,你可以使Web应用程序看起来像Web服务,反之亦然。 主要区别在于基于您使用的平台的内部开发选项。 例如,如果您使用的是Visual Studio,那么添加WCF服务应用程序将为您提供默认情况下针对WCF的项目。 但选择任何其他应用程序类型不会阻止您添加Web服务。 由于以下原因,使用SOAP通常比普通的xml更好: 你的用户会期待它,并且很可能知 ... -
作为你的logcat线: at com.imrankhanandroid.Androidtest.Intentservice.onHandleIntent(Intentservice.java:157) 06-29 18:37:18.796: E/AndroidRuntime(1344): at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65) 意味着问题在于IntentService中的on ...
-
您只需要检查HTTP请求。 HttpContext.Current.Request.UrlReferrer You just need to inspect the HTTP request. HttpContext.Current.Request.UrlReferrer
-
缓存Web服务结果(Caching web service results)[2023-12-03]
结果是Cache.Insert(...)在Page类中。 它需要是Context.Cache.Insert才能在Application缓存中。 卫生署! Turns out that Cache.Insert(...) is in the Page class. It needs to be Context.Cache.Insert to be in the Application cache. Doh! -
更好的是IntentService 编辑:既然兼容包已经出来了,我认为新的Loader类可能是最好的选择,可能使用ASyncTask版本或其变体。 Even better would be an IntentService Edit: Now that the compatibility package is out I think the new Loader class may be the best option, possibly using the ASyncTask version or a v ...
-
是否可以限制Web服务访问它自己的Web应用程序?(Is it possible to restrict web service access to it's own web app?)[2023-04-08]
是否可以阻止从域外部到Web服务(服务器)的连接? 当然。 设置Web服务器的访问控制列表以删除IP范围之外的连接。 或者,安装防火墙。 这非常直截了当,但我怀疑你的意思是“在其域外?” 根据您的描述,您似乎真的在问您是否验证您只是在与您自己的客户端应用程序进行通信。 作为一般规则,没有。 您可以对用户进行身份验证 这很容易。 如果用户未登录并有权使用您的服务,则不会将请求转发给Twitter。 但您无法验证应用程序。 如果您要接受任何出现的用户,您无法阻止他们使用他们想要的任何客户端。 如果您允许它在他们 ... -
这里的正确方法是选项3 - 让您的服务返回Promise this.createEntity = name => new Promise((resolve, reject) => { const query = connection.query('...', { name }, (err, results) => { if (err) return reject(err); return resolve(results.map(r => r.insertId)); }); }) ...
-
我想你可以做两件事。 一:在Web方法上启用[ScriptService]属性。 这允许您使用javascript调用webservice。 例 二:启用http-post / http-get webservice调用如何启用 I think you could do two things. One: enable [ScriptService] attribute on web method. This allows you to call the webservice with javascript. ...
-
ASMX Web引用未更新服务返回类型已更新(ASMX Web Reference not Updating After Service Return Type Updated)[2022-05-16]
只要满足以下几点,这应该起作用: 新属性标记为Public并且必须是读/写的(必须有getter和setter) 您已编译主机Web应用程序(公开Web服务的Web应用程序)。 (您可以尝试在Web浏览器中调用Web服务以检查新属性是否可见)。 您已更新Web引用客户端应用程序(并重建了应用程序) As long as the following points are fulfilled, this should work: the new property is marked as Public and ... -
您应该使用JQuery AJAX请求 。 这是一个简单的例子: $.ajax({ type: "POST", url: "your-web-service-url-here.php", //Optional data to send to the service. data: { name: "John", location: "Boston" } }).done(function( msg ) { //This is the JSON message received from ...