Jump to content

Query matching multiple columns in multiple rows??? (serialized data?)


Jim R

Recommended Posts

The output is just going to be a list of where subscribers reside, and that will only be available to my editors.  Users don't have the opportunity to change their own capability beyond subscribing, and none of the subscription levels affects what they can see on the back end.  Which is also to say I don't follow what your concern is.

  • Replies 51
  • Created
  • Last Reply

SELECT * FROM wp_usermeta um1 
INNER JOIN wp_usermeta um2
JOIN wp_users u
ON um1.user_id=um2.user_id
WHERE um1.meta_key = 'wp_s2member_custom_fields' AND um2.meta_value LIKE "%s2member_level%"
AND um1.user_id = u.ID
ORDER BY um1.user_id

 

 

 

Is that the one?

 

 

SELECT * FROM wp_usermeta um1 
INNER JOIN wp_usermeta um2
JOIN wp_users u
ON um1.user_id=um2.user_id
WHERE um1.meta_key = 'wp_s2member_custom_fields' AND um2.meta_value LIKE "%s2member_level%"
AND um1.user_id = u.ID
GROUP BY um1.user_id
ORDER BY um1.user_id, um1.umeta_id DESC

 

//edit sorry group by before order by

 

@Andy,

 

That worked very well.  Thank you.

 

 

@PFMaBiSmAd

 

I'm still curious about your security concern.  Is it really an issue considering how the output will be? 

 

 

I'm sure I'll be back trying to get help on how to display it how I want.  I have a bit of an idea, but I'll give it a shot.

 

It will eventually look like this for each region:

 

Region # (# of subscribers)

Yearly:

user, user, user, user, user, etc

Semi-annual:

user, user, user, user, user, etc

Monthly:

user, user, user, user, user, etc

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.