Wednesday, March 20, 2019

splitting strings with mysql



SELECT
SUBSTRING_INDEX(email, '@', 1) ,
SUBSTRING_INDEX(email, '@', -1) 
FROM listings

Wednesday, March 13, 2019

mysql date difference

SELECT * FROM myTable 
WHERE dateCol >= DATE_SUB(NOW(),INTERVAL 1 YEAR) LIMIT 0,1


SELECT FROM myTable 
WHERE dateCol >= DATE_SUB(NOW(),INTERVAL YEARLIMIT 0,1



SELECT FROM myTable 
WHERE dateCol >= DATE_SUB(NOW(),INTERVAL MONTHLIMIT 0,1

SELECT FROM myTable 
WHERE dateCol >= DATE_SUB(NOW(),INTERVAL 40 DAYLIMIT 0,1



SELECT FROM myTable 
WHERE dateCol >= DATE_SUB(NOW(),INTERVAL HOURLIMIT 0,1



SELECT FROM myTable 
WHERE dateCol >= DATE_SUB(NOW(),INTERVAL 15 MINUTELIMIT 0,1



SELECT FROM myTable 
WHERE dateCol >= DATE_SUB(NOW(),INTERVAL 600 SECONDLIMIT 0,1

Wednesday, January 9, 2019

cpanel cronjob to delete files older than 7 days

find /home/jerome/public_html/uploads/* -mtime +6 -type f -delete

About

Blogger templates