Checkbox- Automatic Lookup

Good evening all,

I am very new to SC and I must say it is a great application! I am creating an application that utilizes the automatic lookup for the checkbox control. For me the UI development is not a question but rather how can I best extract the data from the data table; what would the query look like?

If the data is stored in a single row with a semicolon as the delimiter, how would I separate out each entry? (Table Example:)

tblRequired
ID Course Department
1 | Course 1 | Dpt1; Dpt2; Dpt3
2 | Course 2 | Dpt3; Dpt4; Dpt5

I guess this is more of an MySQL question.

An example would really help me here!

Thanks for your consideration of my question…

Mark

Hi,
MySql does not provide a function to split a delimited string. You would have to create your own one. It’s not that difficult but not very flexible. I would suggest to have a look at the explode()-function in php, which is pretty straight forward.

jsb

Try using SUBSTRING_INDEX(str,delim,count)

SUBSTRING_INDEX(str,delim,count)

Returns the substring from string str before count occurrences of the delimiter delim. If count is positive, everything to the left of the final delimiter (counting from the left) is returned. If count is negative, everything to the right of the final delimiter (counting from the right) is returned. SUBSTRING_INDEX() performs a case-sensitive match when searching for delim.

mysql> SELECT SUBSTRING_INDEX(‘www.mysql.com’, ‘.’, 2);
-> ‘www.mysql’
mysql> SELECT SUBSTRING_INDEX(‘www.mysql.com’, ‘.’, -2);
-> ‘mysql.com

This function is multi-byte safe.