开发者

How to search a numeric value in a database

Let's say I have query structured like below which indicates dates

searc开发者_如何学运维h.asp?date=091210

I want to find each record that includes 0912 string how can I inquire it on the link structure.


SELECT * FROM YourTable WHERE YourField LIKE '%0912%'


Indeed, never trust anything that is given on a URL. What you should do, is parse the date variable and split it up in a month, day and year part. Be sure to do the necessary sanity checks. Then you can issue a query like: SELECT * FROM yourTable WHERE MONTH(dateColumn) = month AND YEAR(dateColumn) = year

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜