按日期从表中搜索值 [英] search value from table by date

查看:69
本文介绍了按日期从表中搜索值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

提前谢谢。我需要帮助。

我正在使用sql server 2005数据库。其中一个表包含INTNO,name,dateofpurchase,item

等数据现在我想根据名称和dateofpurchase字段搜索值。但没有价值正在检索。我不知道发生了什么。


这里是我正在使用的代码。


< code>

从Point_item_master中选择INTNO,其中PointName =''ABC''和Date =''2010年1月12日''

< / code>


请帮助


NEEL

解决方案



你怎么存储你的mysql中的日期:作为字符串还是作为日期?

如果你在where子句中没有日期进行相同的查询,它会返回什么?


我是使用MS sql server 2005.我将存储为日期。

如果我没有日期查询它运行正常。

但是当我使用日期时它没有返回任何值。


问候

Neel


首先,您在SQL语句中使用了字段名称Date,但您的帖子称该字段名为dateofpurchase。

hi,All thanks in advance. i need a help.
i am working with a sql server 2005 database. where a table contains data like INTNO, name, dateofpurchase , item
now i want to search the value based on name and dateofpurchase fields. but not value is retrieving. i don''t know what is happening.

here is the code i am using.

<code>
select INTNO from Point_item_master where PointName=''ABC'' and Date=''1/12/2010''
</code>

PLEASE HELP

NEEL

解决方案

hi,
how do you store your dates in mysql : as a string or as a date?
what does it return if you make the same query without date in the where clause?


i am using MS sql server 2005. and i am storing as a date.
and if i make query without date it is running fine.
but when i am using date it is not returning any value.

Regards
Neel


Well, first, you used the field name Date in your SQL statement but your post says the field is named dateofpurchase.


这篇关于按日期从表中搜索值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆