开发者

trying to get the single exp payment

开发者 https://www.devze.com 2023-03-19 09:36 出处:网络
I have a query like this SELECT member_Id , PERIOD_DIFF( DATE_FORMAT(now(),\'%开发者_如何转开发Y%m\'),

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

精彩评论

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