remove ridiculously stupid UNION queries
This commit is contained in:
parent
fb891340e6
commit
987170e654
28
backend.php
28
backend.php
|
@ -66,12 +66,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCategoryCounters($link) {
|
function getCategoryCounters($link) {
|
||||||
$result = db_query($link, "SELECT COUNT(int_id) AS unread,cat_id
|
$result = db_query($link, "SELECT cat_id,SUM((SELECT COUNT(int_id)
|
||||||
FROM ttrss_user_entries,ttrss_feeds WHERE unread = true AND feed_id = id
|
FROM ttrss_user_entries WHERE feed_id = ttrss_feeds.id
|
||||||
AND ttrss_feeds.owner_uid = ".$_SESSION["uid"]." GROUP BY cat_id
|
AND unread = true)) AS unread FROM ttrss_feeds
|
||||||
UNION
|
WHERE owner_uid = ".$_SESSION["uid"]." GROUP BY cat_id");
|
||||||
SELECT 0,cat_id FROM ttrss_feeds
|
|
||||||
WHERE ttrss_feeds.owner_uid = ".$_SESSION["uid"]." GROUP BY cat_id");
|
|
||||||
|
|
||||||
while ($line = db_fetch_assoc($result)) {
|
while ($line = db_fetch_assoc($result)) {
|
||||||
$line["cat_id"] = sprintf("%d", $line["cat_id"]);
|
$line["cat_id"] = sprintf("%d", $line["cat_id"]);
|
||||||
|
@ -137,14 +135,19 @@
|
||||||
|
|
||||||
$tctrs_modified = false;
|
$tctrs_modified = false;
|
||||||
|
|
||||||
$result = db_query($link, "SELECT tag_name,count(ttrss_entries.id) AS count
|
/* $result = db_query($link, "SELECT tag_name,count(ttrss_entries.id) AS count
|
||||||
FROM ttrss_tags,ttrss_entries,ttrss_user_entries WHERE
|
FROM ttrss_tags,ttrss_entries,ttrss_user_entries WHERE
|
||||||
ttrss_user_entries.ref_id = ttrss_entries.id AND
|
ttrss_user_entries.ref_id = ttrss_entries.id AND
|
||||||
ttrss_tags.owner_uid = ".$_SESSION["uid"]." AND
|
ttrss_tags.owner_uid = ".$_SESSION["uid"]." AND
|
||||||
post_int_id = ttrss_user_entries.int_id AND unread = true GROUP BY tag_name
|
post_int_id = ttrss_user_entries.int_id AND unread = true GROUP BY tag_name
|
||||||
UNION
|
UNION
|
||||||
select tag_name,0 as count FROM ttrss_tags
|
select tag_name,0 as count FROM ttrss_tags
|
||||||
WHERE ttrss_tags.owner_uid = ".$_SESSION["uid"]);
|
WHERE ttrss_tags.owner_uid = ".$_SESSION["uid"]); */
|
||||||
|
|
||||||
|
$result = db_query($link, "SELECT tag_name,SUM((SELECT COUNT(int_id)
|
||||||
|
FROM ttrss_user_entries WHERE int_id = post_int_id
|
||||||
|
AND unread = true)) AS count FROM ttrss_tags
|
||||||
|
WHERE owner_uid = 2 GROUP BY tag_name ORDER BY tag_name");
|
||||||
|
|
||||||
$tags = array();
|
$tags = array();
|
||||||
|
|
||||||
|
@ -490,14 +493,19 @@
|
||||||
|
|
||||||
// tags
|
// tags
|
||||||
|
|
||||||
$result = db_query($link, "SELECT tag_name,count(ttrss_entries.id) AS count
|
/* $result = db_query($link, "SELECT tag_name,count(ttrss_entries.id) AS count
|
||||||
FROM ttrss_tags,ttrss_entries,ttrss_user_entries WHERE
|
FROM ttrss_tags,ttrss_entries,ttrss_user_entries WHERE
|
||||||
post_int_id = ttrss_user_entries.int_id AND
|
post_int_id = ttrss_user_entries.int_id AND
|
||||||
unread = true AND ref_id = ttrss_entries.id
|
unread = true AND ref_id = ttrss_entries.id
|
||||||
AND ttrss_tags.owner_uid = '$owner_uid' GROUP BY tag_name
|
AND ttrss_tags.owner_uid = '$owner_uid' GROUP BY tag_name
|
||||||
UNION
|
UNION
|
||||||
select tag_name,0 as count FROM ttrss_tags WHERE owner_uid = '$owner_uid'
|
select tag_name,0 as count FROM ttrss_tags WHERE owner_uid = '$owner_uid'
|
||||||
ORDER BY tag_name");
|
ORDER BY tag_name"); */
|
||||||
|
|
||||||
|
$result = db_query($link, "SELECT tag_name,SUM((SELECT COUNT(int_id)
|
||||||
|
FROM ttrss_user_entries WHERE int_id = post_int_id
|
||||||
|
AND unread = true)) AS count FROM ttrss_tags
|
||||||
|
WHERE owner_uid = 2 GROUP BY tag_name ORDER BY tag_name");
|
||||||
|
|
||||||
$tags = array();
|
$tags = array();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue