Skip to content

Instantly share code, notes, and snippets.

@mohamedmansour
Created August 6, 2011 01:16
Show Gist options
  • Save mohamedmansour/1128873 to your computer and use it in GitHub Desktop.
Save mohamedmansour/1128873 to your computer and use it in GitHub Desktop.
Which users are similar to me
SELECT
@UserBit_50 =
IFNULL(
convert(profilevalue_50, unsigned)
,0
)
FROM
se_profilevalues
WHERE
profilevalue_user_id = 1;
SELECT
SUM(
(
convert( IFNULL(profilevalue_50, 0) , unsigned ) &
@UserBit_50) > 0
) / (
SELECT COUNT(*) FROM se_profilevalues
) AS 'Avg Intersection'
FROM
se_profilevalues
WHERE
profilevalue_user_id != 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment