This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
source: http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_replace | |
note: it's case sensitive | |
*/ | |
UPDATE contacts | |
SET description = REPLACE(description, 'Brisvegas', 'Brisbane'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
LTRIM( | |
RTRIM( | |
CONCAT_WS(' ', | |
IFNULL(contacts.salutation, ''), | |
IFNULL(contacts.first_name, ''), | |
IFNULL(contacts.last_name, '') | |
) | |
) | |
) as 'Full Name' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$dictionary['Module_Name']['fields']['field_name']['massupdate'] = true; | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
source ~/last_task_number.txt | |
((TaskNumber++)) | |
echo $TaskNumber | |
echo "TaskNumber=$TaskNumber" > ~/last_task_number.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* MySQL to select and show duplicate CONTACTS in SugarCRM */ | |
SELECT | |
concat_ws(' ',first_name,last_name), | |
phone_work, | |
phone_mobile, | |
deleted | |
FROM contacts | |
WHERE concat_ws(' ',first_name,last_name) IN ( | |
SELECT concat_ws(' ',first_name,last_name) | |
FROM contacts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
SUM(IF(field_name = 'value_one',1,0)) AS 'Value One', | |
SUM(IF(field_name = 'value_two',1,0)) AS 'Value Two', | |
ROUND(SUM(IF(field_name = 'value_one',1,0)) / (SUM(IF(field_name = 'value_one',1,0)) + SUM(IF(field_name = 'value_two',1,0))) * 100) AS 'Percentage' | |
FROM table_name |