开发者

trying to get the single exp payment

I have a query like this

SELECT member_Id ,
       PERIOD_DIFF(
           DATE_FORMAT(now(),'%开发者_如何转开发Y%m'), 
           DATE_FORMAT(memberToMship_StartDate,'%Y%m')
        )  + 
        (
           DAY(memberToMship_StartDate) < memberToMship_DueDay
        ) + 
        (
           DAY(now()) > memberToMship_DueDay
        ) - 1  
        AS ExpPayments 
FROM membertomships

it was giving all exp payments for all members that was fine, can i get the single exp payment for single member.....

Do i need add any join or any where condition ..


If you know the member_Id you could just add a WHERE clause :

SELECT member_Id ,
       PERIOD_DIFF(
           DATE_FORMAT(now(),'%Y%m'), 
           DATE_FORMAT(memberToMship_StartDate,'%Y%m')
        )  + 
        (
           DAY(memberToMship_StartDate) < memberToMship_DueDay
        ) + 
        (
           DAY(now()) > memberToMship_DueDay
        ) - 1  
        AS ExpPayments 
FROM membertomships
WHERE member_Id = 213


add where clause in the end of the query

where  member_Id = {enter the id}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜