SELECT d.user_guid AS dUserID, c.user_guid AS cUserID, d.dog_guid AS dDogID,
c.dog_guid AS dDogID, count(test_name)
FROM dogs d LEFT JOIN complete_tests c
ON d.dog_guid=c.dog_guid
GROUP BY d.dog_guid;
When writing this code, a table was created that was labeled..."dDOGId_1"
the output is virtually the same with the exception of some that have the word "non" in the rows
Is this where the JOIN is happening? Also where is this coming from? Is there something wrong in my code that is creating this additional column?
What? You seem very confused. This is your
select
:No addition table is created. Your result has two columns called
dDogID
. To distinguish between them, the application is adding a_1
.However, including both is entirely unnecessary, because the
left join
implies they are the same. And thecount()
should be counting matches. I assume this is the query you intend:The
c.user_guid
doesn't really make sense in theSELECT
, because it is unclear what row it should be coming from. Perhaps you wantMIN(c.user_guid)
, aMAX()
, orGROUP_CONCAT()
.