[英]How to retrieve record match memberID, month and year from sql database
This might be a stupid question but i failed to do through tutorial found online, i got a table call tblPOS inside got item,quantity,total,memberid,posdate now i gonna retrieve match information for report end of the month what the form do is ask a member id , and month + year he want to see 这可能是一个愚蠢的问题,但我无法通过在线找到的教程来完成,我在表中调用了tblPOS,其中现在有item,quantity,total,memberid,posdate,现在我将检索匹配信息以获取月末报表的格式询问会员编号,以及他想查看的月份和年份
May i know how could i find the match record first check member id, then extract month and year from tblPOS of posdate finally get ONLY record match month and year request for specific member ? 我可以知道如何首先找到会员记录的匹配记录,然后从posdate的tblPOS中提取月份和年份,最后仅获得特定会员的记录匹配年份和月份的请求吗?
Thx in advance =D 提前Thx = D
Your question is unclear, however this query might get you started: 您的问题尚不清楚,但是此查询可能使您入门:
SELECT *
FROM tblPOS
WHERE MemberID = {memberID}
AND posdate >= '2011-02-01' AND postdate < '2011-03-01'
You can use the sql DATEPART()
function, however it is better to format the query with the date range, that way indexes can be used. 您可以使用sql
DATEPART()
函数,但是最好使用日期范围来格式化查询,这样可以使用索引。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.