diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/functions_notification.inc.php | 6 | ||||
-rw-r--r-- | include/functions_tag.inc.php | 4 | ||||
-rw-r--r-- | include/functions_user.inc.php | 4 | ||||
-rw-r--r-- | include/ws_functions.inc.php | 6 |
4 files changed, 10 insertions, 10 deletions
diff --git a/include/functions_notification.inc.php b/include/functions_notification.inc.php index edffe9f99..eecdf1a5e 100644 --- a/include/functions_notification.inc.php +++ b/include/functions_notification.inc.php @@ -476,8 +476,8 @@ function get_recent_post_dates($max_dates, $max_elements, $max_cats) $query = ' SELECT date_available, - COUNT(DISTINCT id) nb_elements, - COUNT(DISTINCT category_id) nb_cats + COUNT(DISTINCT id) AS nb_elements, + COUNT(DISTINCT category_id) AS nb_cats FROM '.IMAGES_TABLE.' i INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id=image_id '.$where_sql.' GROUP BY date_available @@ -515,7 +515,7 @@ SELECT id, path, name, tn_ext, file if ($max_cats>0) {// get some categories ... $query = ' -SELECT c.uppercats, COUNT(DISTINCT i.id) img_count +SELECT c.uppercats, COUNT(DISTINCT i.id) AS img_count FROM '.IMAGES_TABLE.' i INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON i.id=image_id INNER JOIN '.CATEGORIES_TABLE.' c ON c.id=category_id '.$where_sql.' diff --git a/include/functions_tag.inc.php b/include/functions_tag.inc.php index f05746b31..0f5859333 100644 --- a/include/functions_tag.inc.php +++ b/include/functions_tag.inc.php @@ -36,7 +36,7 @@ function get_available_tags() { // we can find top fatter tags among reachable images $query = ' -SELECT tag_id, COUNT(DISTINCT(it.image_id)) counter +SELECT tag_id, COUNT(DISTINCT(it.image_id)) AS counter FROM '.IMAGE_CATEGORY_TABLE.' ic INNER JOIN '.IMAGE_TAG_TABLE.' it ON ic.image_id=it.image_id'.get_sql_condition_FandF ( @@ -223,7 +223,7 @@ function get_common_tags($items, $max_tags, $excluded_tag_ids=null) return array(); } $query = ' -SELECT t.*, count(*) counter +SELECT t.*, count(*) AS counter FROM '.IMAGE_TAG_TABLE.' INNER JOIN '.TAGS_TABLE.' t ON tag_id = id WHERE image_id IN ('.implode(',', $items).')'; diff --git a/include/functions_user.inc.php b/include/functions_user.inc.php index aa35539d6..6eb733bce 100644 --- a/include/functions_user.inc.php +++ b/include/functions_user.inc.php @@ -678,10 +678,10 @@ function compute_categories_data(&$cats) */ function get_computed_categories($userdata, $filter_days=null) { - $query = 'SELECT c.id cat_id, global_rank'; + $query = 'SELECT c.id AS cat_id, global_rank'; // Count by date_available to avoid count null $query .= ', - MAX(date_available) date_last, COUNT(date_available) nb_images + MAX(date_available) AS date_last, COUNT(date_available) AS nb_images FROM '.CATEGORIES_TABLE.' as c LEFT JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON ic.category_id = c.id LEFT JOIN '.IMAGES_TABLE.' AS i diff --git a/include/ws_functions.inc.php b/include/ws_functions.inc.php index 34b1403ec..d0b44b0be 100644 --- a/include/ws_functions.inc.php +++ b/include/ws_functions.inc.php @@ -285,7 +285,7 @@ SELECT id, name, permalink, image_order $order_by = empty($order_by) ? $conf['order_by'] : 'ORDER BY '.$order_by; $query = ' -SELECT i.*, GROUP_CONCAT(category_id) cat_ids +SELECT i.*, GROUP_CONCAT(category_id) AS cat_ids FROM '.IMAGES_TABLE.' i INNER JOIN '.IMAGE_CATEGORY_TABLE.' ON i.id=image_id WHERE '. implode(' @@ -693,7 +693,7 @@ SELECT COUNT(rate) AS count } $query = ' -SELECT COUNT(id) nb_comments +SELECT COUNT(id) AS nb_comments FROM '.COMMENTS_TABLE.' WHERE '.$where_comments; list($nb_comments) = array_from_query($query, 'nb_comments'); @@ -1454,7 +1454,7 @@ function ws_tags_getImages($params, &$service) else { $query = ' -SELECT image_id, GROUP_CONCAT(tag_id) tag_ids +SELECT image_id, GROUP_CONCAT(tag_id) AS tag_ids FROM '.IMAGE_TAG_TABLE.' WHERE tag_id IN ('.implode(',',$tag_ids).') GROUP BY image_id'; |