<?php
// Initialize variables.
$db = JFactory::getDbo();
$subQuery = $db->getQuery(true);
$query = $db->getQuery(true);
// Create the base subQuery select statement.
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
// SQL | |
SELECT | |
`users`.`id`, | |
`users`.`name`, | |
(SELECT | |
GROUP_CONCAT(`k2`.`title`) | |
FROM | |
`jos_k2_items` AS `k2` | |
WHERE | |
`k2`.`created_by` = `users`.`id` |
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 | |
$con = mysql_connect('localhost', 'dbUser', 'dbPassword'); | |
$key = '1234567890123456'; | |
$table = "CREATE TABLE people ( | |
id INT NOT NULL AUTO_INCREMENT, | |
full_name VARCHAR(255), | |
ssn VARCHAR(255), | |
PRIMARY KEY (id) |
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
### Keybase proof | |
I hereby claim: | |
* I am betweenbrain on github. | |
* I am betweenbrain (https://keybase.io/betweenbrain) on keybase. | |
* I have a public key whose fingerprint is 54B6 C5FB C8B0 AB9A 1822 143F 8E98 4A78 99B5 F294 | |
To claim this, I am signing this object: |
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 | |
$db = JFactory::getDbo(); | |
$query = $db->getQuery(true); | |
$query->select($db->quoteName(array('id'))) | |
->from($db->quoteName('#__categories')) | |
->where($db->quoteName('published') . ' = ' . $db->quote('1') . | |
' AND ' . $db->quoteName('extension') . ' = ' . $db->quote('com_content')) | |
->order('LFT ASC'); | |
$db->setQuery($query); | |
$categories = $db->loadObjectList('id'); |
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 | |
$query | |
->select($this->db->quoteName(array( | |
'title', | |
'id', | |
'parent_id'))) | |
->select($this->db->quoteName('metadesc', 'description')) | |
->from($this->db->quoteName('#__categories')) | |
->order($this->db->quoteName('parent_id') . ' ASC') | |
->order($this->db->quoteName('ordering') . ' ASC'); |
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 defined('_JEXEC') or die; | |
/** | |
* File recipients.php | |
* Created 8/1/14 11:38 AM | |
* Author Matt Thomas | matt@betweenbrain.com | http://betweenbrain.com | |
* Support https://github.com/betweenbrain/ | |
* Copyright Copyright (C) 2014 betweenbrain llc. All Rights Reserved. | |
* License GNU GPL v2 or later | |
*/ |
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 | |
table1.id, | |
table1.firstName, | |
table1.lastName, | |
table2.sales, | |
table2.date | |
FROM `table1` | |
LEFT JOIN `table2` ON table1.firstName = table2.firstName; |
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 | |
table1.id, | |
table1.firstName, | |
table1.lastName, | |
table2.sales, | |
table2.date | |
FROM `table1` | |
LEFT JOIN `table2` ON table1.firstName = table2.firstName | |
WHERE MONTH(table2.date) = MONTH(CURRENT_DATE - INTERVAL 1 MONTH); |
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 | |
table1.id, | |
table1.firstName, | |
table1.lastName, | |
a.sales | |
FROM `table1` | |
LEFT JOIN | |
( SELECT | |
firstName, | |
sales, |
OlderNewer