SQL Plugin in action!

14 years 8 months ago #107063 by krileon
Replied by krileon on topic Re:SQL Plugin in action!
[cb_vateams] = 'Cox High School'

That doesn't look right. You're comparing a value to a value that is not query related inside of a query like an IF statement. I do not believe this will work and if this is to be used then you need to quote [cb_vateams].

'[cb_vateams]' = 'Cox High School'


Please try the following:
[code:1]
UPDATE `jos_k2_users` SET `group` =
CASE

WHEN ( '[cb_vateams]' = 'Cox High School' ) THEN 5
WHEN ( '[cb_vateams]' = 'Green Run High School' ) THEN 17
WHEN ( '[cb_vateams]' = 'Hertford High School' ) THEN 4
END
WHERE `userID` = [user_id]
[/code:1]


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.

Please Log in to join the conversation.

14 years 8 months ago #107160 by Goldarm12
Replied by Goldarm12 on topic Re:SQL Plugin in action!
That works great! Thank you very much.
Now I'm trying to do an insert with a select case but once again I have something wrong in my syntax.
[code:1]INSERT INTO `jos_eventlist_register` (`uid`, `event`) VALUES ([user_id], CASE
WHEN ( '[cb_youthcamps]' = 'Va Beach Youth Camp' ) THEN 2
WHEN ( '[cb_youthcamps] = 'Hertford Youth Camp' ) THEN 3
WHEN ( '[cb_youthcamps] = 'E Rochester Youth Camp' ) THEN 6
WHEN ( '[cb_youthcamps] = 'W Rochester Youth Camp' ) THEN 7
WHEN ( '[cb_youthcamps] = 'Andover Youth Camp' ) THEN 4
WHEN ( '[cb_youthcamps] = 'Portland Youth Camp' ) THEN 5
WHEN ( '[cb_youthcamps] = 'Scranton Youth Camp' ) THEN 8
END)[/code:1]

Thanks again for your help,
Don

Please Log in to join the conversation.

14 years 8 months ago #107168 by Goldarm12
Replied by Goldarm12 on topic Re:SQL Plugin in action!
I just found my error, I didn't have the single quotes on all items. Here it is corrected and working.
[code:1]INSERT INTO `jos_eventlist_register` (`uid`, `event`) VALUES ([user_id], CASE
WHEN ( '[cb_youthcamps]' = 'Va Beach Youth Camp' ) THEN 2
WHEN ( '[cb_youthcamps]' = 'Hertford Youth Camp' ) THEN 3
WHEN ( '[cb_youthcamps]' = 'E Rochester Youth Camp' ) THEN 6
WHEN ( '[cb_youthcamps]' = 'W Rochester Youth Camp' ) THEN 7
WHEN ( '[cb_youthcamps]' = 'Andover Youth Camp' ) THEN 4
WHEN ( '[cb_youthcamps]' = 'Portland Youth Camp' ) THEN 5
WHEN ( '[cb_youthcamps]' = 'Scranton Youth Camp' ) THEN 8
END)[/code:1]

I'm really liking this component.
Thanks, Don

Please Log in to join the conversation.

14 years 7 months ago #108937 by huntrdog
Replied by huntrdog on topic Re:SQL Plugin in action!
Can anyone please let me know where I can find this CBSubs/Mosets Tree plugin?? I've searched the forums for hours without success.

Thanks in advance!

Please Log in to join the conversation.

14 years 7 months ago #108964 by nant
Replied by nant on topic Re:SQL Plugin in action!
huntrdog wrote:

Can anyone please let me know where I can find this CBSubs/Mosets Tree plugin?? I've searched the forums for hours without success.

Thanks in advance!


There is no such plugin.
Only SQL statements that can be used by SQL plugin.

And the SQL statements are provided in the first post of this thread!

Post edited by: nant, at: 2009/08/22 21:26

Please Log in to join the conversation.

14 years 7 months ago #109109 by huntrdog
Replied by huntrdog on topic Re:SQL Plugin in action!
nant wrote:

huntrdog wrote:

Can anyone please let me know where I can find this CBSubs/Mosets Tree plugin?? I've searched the forums for hours without success.

Thanks in advance!


There is no such plugin.
Only SQL statements that can be used by SQL plugin.

And the SQL statements are provided in the first post of this thread!

Post edited by: nant, at: 2009/08/22 21:26


Thanks, Nant...as I expected. The words "mosets plugin" was used in this thread so I wanted to be sure.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.180 seconds