Last active
April 30, 2018 22:43
-
-
Save gregaeq/cd3aef84c658e117e39f524304278478 to your computer and use it in GitHub Desktop.
GetMembersWithIsContactAndIsInviteForUserId
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SET @Test = "08770871-df3b-4d02-ae40-fd9bb340b39a"; | |
SELECT UUID_FROM_BIN(T1.user_id) as UUID, group_id, | |
( | |
SELECT COUNT(id) > 0 | |
FROM contact | |
WHERE sender_id = T1.user_id AND recipient_id = UUID_TO_BIN(@Test) | |
OR sender_id = UUID_TO_BIN(@Test) AND recipient_id = T1.user_id | |
) as Is_Contact, | |
( | |
SELECT COUNT(id) > 0 | |
FROM invite | |
WHERE sender_id = T1.user_id AND recipient_id = UUID_TO_BIN(@Test) | |
OR sender_id = UUID_TO_BIN(@Test) AND recipient_id = T1.user_id | |
) as Is_Invited | |
FROM Kinzoodev.member T1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment