Repeated duplicate values in fetching query causing problems


#1

hi,
i’m trying to create a query that fetches unique users statuses and group posts from multiple tables. I seem to get them but the problem is i’m getting duplicate values along with them repeatedly. It would be of great help if you experts can solve it.

here is the query:

select DISTINCTROW g.* ,cu.*,gm.*,gp.*,up.*, u.uname,u.avatar,u.user_id from group_posts as g 
left outer join user as u
on u.uname=g.author_gp 
left outer join updates as up 
on up.author=u.uname
left outer join groups as gp
on g.group_id=gp.g_id
left outer join gmembers as gm
on gm.gname=g.gname
left outer join comment_update as cu
on cu.os_id=up.update_id
where g.gname='MEP news' and u.uname='shan2batman' GROUP by g.gp_id,up.update_body having u.uname='shan2batman'and g.gname='MEP news' order by u.user_id desc

here is the output:

+ Options
gp_id	pid	gname	author_gp	type	title	data	pdate	vote_up	vote_down	user_id_g	group_id	comment_id	comment_body	time_c	os_id	author_c	type_c	vote_up_c	vote_down_c	user_id_c	gm_id	gname	mname	approved	admin	g_id	name	creation	logo	invrule	creator	description	update_id	update_body	url	time	host	vote_up	vote_down	title	user_id_u	account_name	author	type	data	uname	avatar	user_id  Descending 1	
gp_id
pid
gname
author_gp
type
title
data
pdate
vote_up
vote_down
user_id_g
group_id
comment_id
comment_body
time_c
os_id
author_c
type_c
vote_up_c
vote_down_c
user_id_c
gm_id
gname
mname
approved
admin
g_id
name
creation
logo
invrule
creator
description
update_id
update_body
url
time
host
vote_up
vote_down
title
user_id_u
account_name
author
type
data
uname
avatar
user_id  Descending 1
16
0
MEP news
shan2batman
0
how do i overcome the problems
lets see how it works after i delete group posts
2018-09-24 11:55:44
0
0
0
25
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
1
MEP news
aboutthecreator
1
1
25
MEP news
2016-06-25 06:06:41
TueDec619191620165366.png
1
aboutthecreator
MEP is a social network that aims to be like faceb...
288
what kind of a life am i living??
2016-06-15 22:01:09
0
0
hai
127
shan2batman
shan2batman
a
shan2batman
WedDec715012120167478.png
127
18
16
MEP news
shan2batman
1
this is a comment
2018-09-24 12:31:48
0
0
0
0
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
1
MEP news
aboutthecreator
1
1
NULL
NULL
NULL
NULL
NULL
NULL
NULL
288
what kind of a life am i living??
2016-06-15 22:01:09
0
0
hai
127
shan2batman
shan2batman
a
shan2batman
WedDec715012120167478.png
127
19
17
MEP news
shan2batman
1
this is a second comment
2018-09-24 12:32:39
0
0
0
0
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
1
MEP news
aboutthecreator
1
1
NULL
NULL
NULL
NULL
NULL
NULL
NULL
288
what kind of a life am i living??
2016-06-15 22:01:09
0
0
hai
127
shan2batman
shan2batman
a
shan2batman
WedDec715012120167478.png
127
16
0
MEP news
shan2batman
0
how do i overcome the problems
lets see how it works after i delete group posts
2018-09-24 11:55:44
0
0
0
25
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
1
MEP news
aboutthecreator
1
1
25
MEP news
2016-06-25 06:06:41
TueDec619191620165366.png
1
aboutthecreator
MEP is a social network that aims to be like faceb...
289
man im having the best luck im going to be a billi...
2016-06-15 22:05:00
0
0
bye
127
shan2batman
shan2batman
a
shan2batman
WedDec715012120167478.png
127
18
16
MEP news
shan2batman
1
this is a comment
2018-09-24 12:31:48
0
0
0
0
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
1
MEP news
aboutthecreator
1
1
NULL
NULL
NULL
NULL
NULL
NULL
NULL
289
man im having the best luck im going to be a billi...
2016-06-15 22:05:00
0
0
bye
127
shan2batman
shan2batman
a
shan2batman
WedDec715012120167478.png
127
19
17
MEP news
shan2batman
1
this is a second comment
2018-09-24 12:32:39
0
0
0
0
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
1
MEP news
aboutthecreator
1
1
NULL
NULL
NULL
NULL
NULL
NULL
NULL
289
man im having the best luck im going to be a billi...
2016-06-15 22:05:00
0
0
bye
127
shan2batman
shan2batman
a
shan2batman
WedDec715012120167478.png
127
16
0
MEP news
shan2batman
0
how do i overcome the problems
lets see how it works after i delete group posts
2018-09-24 11:55:44
0
0
0
25
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
1
MEP news
aboutthecreator
1
1
25
MEP news
2016-06-25 06:06:41
TueDec619191620165366.png
1
aboutthecreator
MEP is a social network that aims to be like faceb...
290
#qwert is it ready<br /><img src="ht...
2016-08-12 20:16:15
0
0
qwertyu
127
shan2batman
shan2batman
a
shan2batman
WedDec715012120167478.png
127
18
16
MEP news
shan2batman
1
this is a comment
2018-09-24 12:31:48
0
0
0
0
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
1
MEP news
aboutthecreator
1
1
NULL
NULL
NULL
NULL
NULL
NULL
NULL
290
#qwert is it ready<br /><img src="ht...
2016-08-12 20:16:15
0
0
qwertyu
127
shan2batman
shan2batman
a
shan2batman
WedDec715012120167478.png
127
19
17
MEP news
shan2batman
1
this is a second comment
2018-09-24 12:32:39
0
0
0
0
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
1
MEP news
aboutthecreator
1
1
NULL
NULL
NULL
NULL
NULL
NULL
NULL
290
#qwert is it ready<br /><img src="ht...
2016-08-12 20:16:15
0
0
qwertyu
127
shan2batman
shan2batman
a
shan2batman
WedDec715012120167478.png
127
16
0
MEP news
shan2batman
0
how do i overcome the problems
lets see how it works after i delete group posts
2018-09-24 11:55:44
0
0
0
25
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
1
MEP news
aboutthecreator
1
1
25
MEP news
2016-06-25 06:06:41
TueDec619191620165366.png
1
aboutthecreator
MEP is a social network that aims to be like faceb...
291
<img src="tinymce/js/tinymce/plugins/emoti...
2016-08-12 20:18:27
0
0
poiuytr
127
shan2batman
shan2batman
a
<br><b>Shared via .<br>
shan2batman
WedDec715012120167478.png
127
18
16
MEP news
shan2batman
1
this is a comment
2018-09-24 12:31:48
0
0
0
0
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
1
MEP news
aboutthecreator
1
1
NULL
NULL
NULL
NULL
NULL
NULL
NULL
291
&lt;img src=&quot;tinymce/js/tinymce/plugins/emoti...
2016-08-12 20:18:27
0
0
poiuytr
127
shan2batman
shan2batman
a
<br><b>Shared via .<br>
shan2batman
WedDec715012120167478.png
127
19
17
MEP news
shan2batman
1
this is a second comment
2018-09-24 12:32:39
0
0
0
0
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
1
MEP news
aboutthecreator
1
1
NULL
NULL
NULL
NULL
NULL
NULL
NULL
291
&lt;img src=&quot;tinymce/js/tinymce/plugins/emoti...
2016-08-12 20:18:27
0
0
poiuytr
127
shan2batman
shan2batman
a
<br><b>Shared via .<br>
shan2batman
WedDec715012120167478.png
127
16
0
MEP news
shan2batman
0
how do i overcome the problems
lets see how it works after i delete group posts
2018-09-24 11:55:44
0
0
0
25
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
1
MEP news
aboutthecreator
1
1
25
MEP news
2016-06-25 06:06:41
TueDec619191620165366.png
1
aboutthecreator
MEP is a social network that aims to be like faceb...
296
hello #qwert
2016-08-12 20:21:10
0
0
test message!
127
shan2batman
shan2batman
a
shan2batman
WedDec715012120167478.png
127
18
16
MEP news
shan2batman
1
this is a comment
2018-09-24 12:31:48
0
0
0
0
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
1
MEP news
aboutthecreator
1
1
NULL
NULL
NULL
NULL
NULL
NULL
NULL
296
hello #qwert
2016-08-12 20:21:10
0
0
test message!
127
shan2batman
shan2batman
a
shan2batman
WedDec715012120167478.png
127
19
17
MEP news
shan2batman
1
this is a second comment
2018-09-24 12:32:39
0
0
0
0
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
1
MEP news
aboutthecreator
1
1
NULL
NULL
NULL
NULL
NULL
NULL
NULL
296
hello #qwert
2016-08-12 20:21:10
0
0
test message!
127
shan2batman
shan2batman
a
shan2batman
WedDec715012120167478.png
127
16
0
MEP news
shan2batman
0
how do i overcome the problems
lets see how it works after i delete group posts
2018-09-24 11:55:44
0
0
0
25
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
1
MEP news
aboutthecreator
1
1
25
MEP news
2016-06-25 06:06:41
TueDec619191620165366.png
1
aboutthecreator
MEP is a social network that aims to be like faceb...
297
Hi, @aboutthecreator i welcome you to myexpresspad
2016-09-25 16:53:01
0
0
lets test this message
127
shan2batman
shan2batman
a
shan2batman
WedDec715012120167478.png
127
18
16
MEP news
shan2batman
1
this is a comment
2018-09-24 12:31:48
0
0
0
0
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
1
MEP news
aboutthecreator
1
1
NULL
NULL
NULL
NULL
NULL
NULL
NULL
297
Hi, @aboutthecreator i welcome you to myexpresspad
2016-09-25 16:53:01
0
0
lets test this message
127
shan2batman
shan2batman
a
shan2batman
WedDec715012120167478.png
127
19
17
MEP news
shan2batman
1
this is a second comment
2018-09-24 12:32:39
0
0
0
0
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
1
MEP news
aboutthecreator
1
1
NULL
NULL
NULL
NULL
NULL
NULL
NULL
297
Hi, @aboutthecreator i welcome you to myexpresspad
2016-09-25 16:53:01
0
0
lets test this message
127
shan2batman
shan2batman
a
shan2batman
WedDec715012120167478.png
127
16
0
MEP news
shan2batman
0
how do i overcome the problems
lets see how it works after i delete group posts
2018-09-24 11:55:44
0
0
0
25
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
1
MEP news
aboutthecreator
1
1
25
MEP news
2016-06-25 06:06:41
TueDec619191620165366.png
1
aboutthecreator
MEP is a social network that aims to be like faceb...
299
what to expect from <a class="twitter-hashtag pret...
2016-11-04 03:54:27
0
0
my first post
127
shan2batman
shan2batman
a
shan2batman
WedDec715012120167478.png
127
18
16
MEP news
shan2batman
1
this is a comment
2018-09-24 12:31:48
0
0
0
0
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
1
MEP news
aboutthecreator
1
1
NULL
NULL
NULL
NULL
NULL
NULL
NULL
299
what to expect from <a class="twitter-hashtag pret...
2016-11-04 03:54:27
0
0
my first post
127
shan2batman
shan2batman
a
shan2batman
WedDec715012120167478.png
127
19
17
MEP news
shan2batman
1
this is a second comment
2018-09-24 12:32:39
0
0
0
0
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
1
MEP news
aboutthecreator
1
1
NULL
NULL
NULL
NULL
NULL
NULL
NULL
299
what to expect from <a class="twitter-hashtag pret...
2016-11-04 03:54:27
0
0
my first post
127
shan2batman
shan2batman
a
shan2batman
WedDec715012120167478.png
127
16
0
MEP news
shan2batman
0
how do i overcome the problems
lets see how it works after i delete group posts
2018-09-24 11:55:44
0
0
0
25
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
1
MEP news
aboutthecreator
1
1
25
MEP news
2016-06-25 06:06:41
TueDec619191620165366.png
1
aboutthecreator
MEP is a social network that aims to be like faceb...
304
i'm on cloud nine
2016-12-07 10:22:14
0
0
oooh yeah
127
shan2batman
shan2batman
a
shan2batman
WedDec715012120167478.png
127
18
16
MEP news
shan2batman
1
this is a comment
2018-09-24 12:31:48
0
0
0
0
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
1
MEP news
aboutthecreator
1
1
NULL
NULL
NULL
NULL
NULL
NULL
NULL
304
i'm on cloud nine
2016-12-07 10:22:14
0
0
oooh yeah
127
shan2batman
shan2batman
a
shan2batman
WedDec715012120167478.png
127
19
17
MEP news
shan2batman
1
this is a second comment
2018-09-24 12:32:39
0
0
0
0
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
1
MEP news
aboutthecreator
1
1
NULL
NULL
NULL
NULL
NULL
NULL
NULL
304
i'm on cloud nine
2016-12-07 10:22:14
0
0
oooh yeah
127
shan2batman
shan2batman
a
shan2batman
WedDec715012120167478.png
127
16
0
MEP news
shan2batman
0
how do i overcome the problems
lets see how it works after i delete group posts
2018-09-24 11:55:44
0
0
0
25
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
1
MEP news
aboutthecreator
1
1
25
MEP news
2016-06-25 06:06:41
TueDec619191620165366.png
1
aboutthecreator
MEP is a social network that aims to be like faceb...
305
i'm on cloud nine
2016-12-07 10:22:14
0
0
oooh yeah
127
shan2batman
shan2batman
a
shan2batman
WedDec715012120167478.png
127


#2

if anyone wants the sql dump for solving the problem pl pm me.


#3

please describe the one-to-many relationships between your tables – that’s where your issue is coming from

also, the HAVING clause is redundant


#4

Wouldn’t the SELECT DISTINCTROW cause an issue as well?


#5

i think that’s a Microsoft Access option, not sure but it looks okay if it works

of more concern is that there are many many columns in the SELECT clause that have been omitted from the GROUP BY clause and i’m not sure how this query even gets to the execution stage


#6

there are no linked rows in the db or no foreign keys i’m just referring them to on names and id’s between different tables.


#7

i’m not sure you understood the question

in this first join –

group_posts as g left outer join user as u on u.uname=g.author_gp

i’m going to guess a single user can have multiple group posts

for this join –

left outer join updates as up on up.author=u.uname

i’m going to assume a single user can have multiple updates

for this join –

left outer join groups as gp on g.group_id=gp.g_id

i’m going to assume each group post belongs to only one group

see what i’m doing? i’m trying to understand how your joins are working by looking at the one-to-many relationships in your tables

this is where your “duplicates” issue is coming from


#8

you are correct i’ll write the one to many relationships as soon as possible


#9

DB structure:

CREATE TABLE `comment_update` (
  `comment_id` int(255) NOT NULL,
  `comment_body` mediumtext NOT NULL,
  `time_c` datetime NOT NULL,
  `os_id` int(255) NOT NULL,
  `author_c` varchar(255) NOT NULL,
  `type_c` enum('b') NOT NULL,
  `vote_up_c` int(255) NOT NULL,
  `vote_down_c` int(255) NOT NULL,
  `user_id_c` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Table structure for table `gmembers`
--

CREATE TABLE `gmembers` (
  `gm_id` int(255) NOT NULL,
  `gname` varchar(100) NOT NULL,
  `mname` varchar(100) NOT NULL,
  `approved` enum('0','1') NOT NULL,
  `admin` int(255) NOT NULL,
  `group_id` int(255) NOT NULL,
  `user_id_group` int(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- Table structure for table `groups`
--

CREATE TABLE `groups` (
  `g_id` int(255) NOT NULL,
  `name` varchar(100) NOT NULL,
  `creation` datetime NOT NULL,
  `logo` varchar(255) NOT NULL,
  `invrule` enum('0','1') NOT NULL,
  `creator` varchar(100) NOT NULL,
  `description` varchar(5000) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;


-- Table structure for table `group_posts`
--

CREATE TABLE `group_posts` (
  `gp_id` int(255) NOT NULL,
  `pid` varchar(16) NOT NULL,
  `gname` varchar(100) NOT NULL,
  `author_gp` varchar(255) NOT NULL,
  `type` enum('0','1') NOT NULL,
  `title` varchar(500) NOT NULL,
  `data` varchar(10000) NOT NULL,
  `pdate` datetime NOT NULL,
  `vote_up` int(255) NOT NULL,
  `vote_down` int(255) NOT NULL,
  `group_id` int(255) NOT NULL,
  `author_id` int(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- Table structure for table `updates`
--

CREATE TABLE `updates` (
  `update_id` int(255) NOT NULL,
  `update_body` varchar(10000) NOT NULL,
  `url` varchar(100) NOT NULL,
  `time` datetime NOT NULL,
  `host` varchar(100) NOT NULL,
  `vote_up` int(255) NOT NULL,
  `vote_down` int(255) NOT NULL,
  `title` varchar(1000) NOT NULL,
  `user_id_u` int(255) NOT NULL,
  `account_name` varchar(255) NOT NULL,
  `author` varchar(255) NOT NULL,
  `type` enum('a','b','c') NOT NULL,
  `data` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;


-- Table structure for table `user`
--

CREATE TABLE `user` (
  `user_id` int(255) NOT NULL,
  `fname` varchar(50) NOT NULL,
  `lname` varchar(50) NOT NULL,
  `uname` varchar(50) NOT NULL,
  `pass` varchar(50) NOT NULL,
  `email` varchar(100) NOT NULL,
  `phone` int(30) NOT NULL,
  `avatar` varchar(1000) NOT NULL,
  `activated` int(255) NOT NULL,
  `notescheck` datetime NOT NULL,
  `work` varchar(255) NOT NULL,
  `graduation` varchar(255) NOT NULL,
  `school` varchar(255) NOT NULL,
  `city` varchar(255) NOT NULL,
  `about_me` varchar(255) NOT NULL,
  `residence` varchar(255) NOT NULL,
  `gender` varchar(50) NOT NULL,
  `interests` varchar(255) NOT NULL,
  `quote` varchar(255) NOT NULL,
  `privacy` enum('0','1','2') NOT NULL DEFAULT '0',
  `like_person_count` int(255) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

Query:

query="select DISTINCT up.*,g.*,cu.*,gm.*,gp.*,u.uname,u.avatar,u.user_id from group_posts as g "
                 
                 . "left outer join user as u "
                 . "on u.uname=g.author_gp "
                 . "left outer join updates as up"
                 . " on up.author=u.uname"
                 . " left outer join groups as gp "
                 . "on g.gname=gp.name"
                 . " left outer join gmembers as gm"
                 . " on gm.user_id_group=u.user_id "
                 . "left outer join comment_update as cu "
                 . "on cu.os_id=up.update_id "
                 . "where g.gname=:group_name and u.uname= :user_name"
                 . " GROUP by up.update_id,g.gp_id order by u.user_id desc";

the first join is where uname and author_gp is common and is fetching results as other combinations fail, the second join is where u.uname is common with updates table this updates table is where user statuses is stored, the third join is where g.gname is common with groups name other combinations fail to fetch results, the next join is where group members is equal to u.uname(user name) of the user and there are no common tables other than this, the nextr table comment update is comments for updates table and os_id(original status id) is equal to updates update_id


#10

@r937 can you pl help me come with a query that eliminates duplicates


#11

certainly willing to try

however, you still have not identified the one-to-many relationships

also, to create a new query, i would need to know exactly what the query should be producing

so far, with all those evil “select star” references, i seems like just a dump


#12

@r937 i’m green when it comes to sql queries can you teach me???


#13

we have to produce all the user status data from updates table and group posts table the updates table has a different comments_update table where the comments are stored and the only thing that references it to the update table is comments comments_update.os_id to updates.update_id .In the group posts the comments is within the table itself, where the pid references the gp_id in group_posts table the groups table is where there is group photo link so i reference group.g_id with group_posts.group_id or groups.name to group_posts.gname.let me know if you need more data plus if you want sql dump i’m willing to give you pm me your email if you want to go that way.


#14

i’ve asked three times, and i still don’t think you understand the question

you might need to get someone else to explain what a one-to-many relationship is

your tables are full of them

consider these two statements –

  • each row in table X can have more than one row in table Y

  • each row in table Y can have only one row in table X

this is what i want – this is a one-to-many relationship between X and Y

i want you to fill in both of these statements (they both apply to a single relationship) for every join in your query

this is where your duplicates issue is coming from


#15

is this enough
The updates table has three user values comparable to user table
1)updates.user_id_u is relational to user.user_id
2) updates.account_name and updates.author is relational to user.uname.
The groups table is complex where 1)groups.g_id is relational to group_posts.group_id
2)groups.name is relational to group_posts.gname
The group_posts table has many relationships 1)the group_posts.group_id is relational to groups.g_id and group_posts.gname is relational to groups.g_id
2)the group_posts.author_id is relational to user.user_id and user.uname is relational to group_posts.author_gp
3) the group_posts.pid is relational to group_posts.gp_id as the pid is comments in groups connected to group_posts.gp_id’s


#16

no, that’s not good enough, i still cannot easily see which side of the relationship is the “one” side and which is the “many” side

please write these two statements for each join –

  • each row in table X can have more than one row in table Y
  • each row in table Y can have only one row in table X

i am slowly reaching the point where i think it might be best if you went out and hired someone to do your query for you


#17

@r937

query:

select DISTINCTROW up.*,g.* ,cu.*,gm.*,gp.*, u.uname,u.avatar,u.user_id from group_posts as g 
left outer join user as u
on u.user_id=g.author_id 
left outer join updates as up 
on up.user_id_u=u.user_id
left outer join groups as gp
on g.group_id=gp.g_id
left outer join gmembers as gm
on gm.user_id_group=g.author_id
left outer join comment_update as cu
on cu.os_id=up.update_id
where gp.group_id=25 and u.user_id=127 GROUP by up.update_id,g.gp_id order by u.user_id desc

in the first join u.user_id is relational to g.author_id and so is u.uname relational to g.author_gp
in the second join up.user_id_u and u.user_id is relational, so is up.account_name and up.author
in the third join g.group_id is relational to gp.g_id and g.gname to gp.name
in the fourth join gm.user_id_group is relational to g.author_id and so is it relational to u.user_id and gm.group_id is relational to gp.g_id and gm.mname is relational to u.uname and gm.gname is relational to g.gname
in the fifth join cu.os_id is relational to up.update_id and cu.author_c is relational to u.uname and so is u.user_id relational to cu.user_id_c


#18

I have trouble following the query. Is this intentional?

group_posts AS g 
... 
groups AS gp 

Maybe you have no problem with that, but it would trip me up sooner or later.

Maybe it would help if you skip using table aliases while you work up the query?


#19

ok ill change it if you want it that way


#20

@r937 any luck with the query bro