Whats wrong with my mysql JOIN, I am not getting the right results

taxeeta

Table A has userIdentity (primaryKey) userName userPhoneNumber

Table B has someOtherKey(primaryKey) userIdentity userLocation

I get 22 rows with unique userIdentity when I run

SELECT *
FROM tableB 
WHERE tableB.timeStamp > '2013-11-1' 
GROUP BY tableB.userIdentity ;

I get only 2 rows when I run (I intend to extract name and phone number of the 22 rows in the above query)

SELECT tableA.userName, tableA.phonePhoneNumber 
FROM tableB
JOIN tableA 
WHERE tableB.timeStamp > '2013-11-1'
GROUP BY tableB.userIdentity
    AND tableA.identityHash = tableB.identityHash;
Flimzy

I'm pretty sure your 'AND' clause is in the wrong place. What you probably meant to do was:

SELECT tableA.userName, tableA.phonePhoneNumber 
FROM tableB JOIN tableA 
WHERE tableB.timeStamp > '2013-11-1'
    AND tableA.identityHash = tableB.identityHash
GROUP BY tableB.userIdentity;

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

JavaScript - I am getting wrong results from my script

My LEFT JOIN is not returning correct results. What am I doing wrong?

Getting runtime error on submission for Kattis "Perket" problem. I am getting the right output locally, what is wrong with my code?

How to write the data into json file for the following code below and i am getting the following errors any one help me whats wrong in my code

mex: Calculation right; but, I am getting wrong output

Why I am not getting 84.0? Whats wrong in the programming ?You must use recursion for this function

MySQL Join with the wrong results

Why am I getting wrong results with this implemention of a sum reduction in CUDA?

mysql query for two tables with left join- getting wrong results

Whats wrong with my PDO mysql query

Why am I getting the wrong parent node in my function?

what is wrong with my findOutlier function? why am i getting error?

Please explain me why i am getting this error in snakemake? I´ve been strugling for days please advise me on whats going wrong

Why am I getting different results with my code?

What is wrong with my code? I am stuck. I am trying to export some promise results

Where I am getting wrong?

Where am I getting it wrong?

Getting wrong results on mysql queries

Whats wrong with my validates?

Whats wrong with my class

Whats wrong with my logic

Whats wrong with my query?

mysql whats wrong with these this query trying to join to Select statements

i want to find number of occurrences of substring in string(without using count function) but i am getting wrong results

sql conditional join getting wrong results

it's not sorted using "sorted", and getting a wrong answer. And I am not sure if the algorithm is right

why am i getting the wrong answer for the index of the number whos left sum=right sum in the list

Getting Different results with "LEFT OUTER JOIN" and "IN", where did my logic go wrong?

My sorting is not working in razor view but in my code i am getting the right result