I want to make a single select query field where I can choose users from a certain usergroup:
SELECT `a.id`,`a.name`,`b.user_id`, `b.group_id` FROM `#__users`, `a` INNER JOIN `#__user_usergroup_map`, `b` ON `a.id` = `b.user_id` WHERE `b.group_id` LIKE `17` ORDER `a.name` ASC
The above works in a Joomla db query, but it throws an error in the CB query field - why ?
That query is not valid. It has syntax errors and escaping errors. Joomla likely is just not throwing an error. CB does not suppress errors as it's bad practice and prevents you from knowing when something is wrong. The below is valid.
Code:
SELECT a.`id`, a.`name`, b.`user_id`, b.`group_id` FROM `#__users` AS `a` INNER JOIN `#__user_usergroup_map` AS `b` ON a.`id` = b.`user_id` WHERE b.`group_id` = 17 ORDER BY a.`name` ASC
See the below for SQL resources on how to write valid SQL.
Kyle (Krileon) Community Builder Team Member Before posting on forums:
Read FAQ thoroughly
+
Read our Documentation
+
Search the forums CB links:
Documentation
-
Localization
-
CB Quickstart
-
CB Paid Subscriptions
-
Add-Ons
-
Forge
-- If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
-- If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please
send me a private message
with your thread and will reply when possible!
-- Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
-- My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
Last edit: 8 years 11 months ago by krileon. Reason: typo