Jump to content

need help with mysql query


minadreapta

Recommended Posts

Hello,

 

what i want to to is basically this:

i want all the domain names in my whmcs that have:

- extension is ".tld"

- registrar is "email"

- status is "active", "cancelled" or "expired"

- expiration date is like "2012-mm-dd"

 

if the above conditions are fulfilled, to move the expiration date from 2012-mm-dd to 2212-mm-dd (2 hundred years in the future).

 

is this possible?

 

thanks.

Link to comment
Share on other sites

You can use the following as a starting point and modify as per your own needs.

 

SELECT id
FROM `tbldomains`
WHERE
   `domain` LIKE '%.tld'
   AND `registrar` = 'email'
   AND `expirydate` BETWEEN '2012-01-01' AND '2012-12-31'
   AND `status` IN ('Active', 'Expired', 'Cancelled')

 

You can use DATE_ADD to figure out what the new dates should be.

DATE_ADD(expirydate, INTERVAL 200 YEAR)

 

Try this...

SELECT id, DATE_ADD(expirydate, INTERVAL 200 YEAR) AS NewExpiryDate
FROM `tbldomains`
WHERE
   `domain` LIKE '%.tld'
   AND `registrar` = 'email'
   AND `expirydate` BETWEEN '2012-01-01' AND '2012-12-31'
   AND `status` IN ('Active', 'Expired', 'Cancelled')

Edited by WHMCS JamesX
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated