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.

Link to comment
Share on other sites

  • Replies 51
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • 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.