Executing the SQL statement in a Members list menu item

  • Peter Bibb
  • Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
1 year 9 months ago #152764 by Peter Bibb
Hi Tuan,
We want to run a number of bespoke SQLs to provide lists of members along the lines of:
SELECT  * FROM `liv_osmembership_field_value` WHERE `field_id` = 37 AND `field_value` CONTAINS "Ice Creams"

It appears that the Menu item screen is truncating the statement because we get the following message:  1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT * FROM `#__osmembership_field_value` WHERE `field_id` = 37 AND `field_v' at line 5.

Are we doing something wrong?

Thanks

Peter

Please Log in or Create an account to join the conversation.

More
1 year 9 months ago - 1 year 9 months ago #152775 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Executing the SQL statement in a Members list menu item
Hi Peter

The SQL command you are using does not look right to me. Could you change it to :

Code:
tbl.id IN (SELECT subscriber_id FROM `liv_osmembership_field_value` WHERE `field_id` = 37 AND `field_value` LIKE "%Ice Creams%")


Then check to see if it works ?

Tuan
Last edit: 1 year 9 months ago by Tuan Pham Ngoc. Reason: Update SQL command
The following user(s) said Thank You: Peter Bibb

Please Log in or Create an account to join the conversation.

  • Peter Bibb
  • Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
1 year 9 months ago #152777 by Peter Bibb
Thank you, this works perfectly, well done and thanks for the speedy service!

Please Log in or Create an account to join the conversation.

More
1 year 9 months ago #152778 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Executing the SQL statement in a Members list menu item
You're welcome. Happy to hear that it helped

Please Log in or Create an account to join the conversation.

Moderators: Tuan Pham Ngoc