Hello,
I was hoping someone could help me with this SQL statement.
The column 'options.option Descrip' is a varchar field.
Some values of the 'options.option Descrip' contain commas, some do
not.
We are trying to evaluate against any data in the
'options.option Descrip' column located to the left of a comma (if a
comma does exist, which it may not). If no comma exists, then we try
and evaluate against the entire field, not just the part to the left
of the comma.
SELECT options_options Groups.idProduc t FROM options_options Groups
JOIN Options ON options_options Groups.idOption =options.idOpti on
JOIN products ON options_options Groups.idProduc t=products.idPr oduct
WHERE (CASE WHEN CharIndex(',',o ptions.optionDe scrip) = 0 THEN
options.optionD escrip LIKE '" & gauge & "%' ELSE
Left(options.op tionDescrip,Cha rIndex(',',opti ons.optionDescr ip)) LIKE
'" & gauge & "%' END)
Thanks for any input you can provide, I appreciate it.
I was hoping someone could help me with this SQL statement.
The column 'options.option Descrip' is a varchar field.
Some values of the 'options.option Descrip' contain commas, some do
not.
We are trying to evaluate against any data in the
'options.option Descrip' column located to the left of a comma (if a
comma does exist, which it may not). If no comma exists, then we try
and evaluate against the entire field, not just the part to the left
of the comma.
SELECT options_options Groups.idProduc t FROM options_options Groups
JOIN Options ON options_options Groups.idOption =options.idOpti on
JOIN products ON options_options Groups.idProduc t=products.idPr oduct
WHERE (CASE WHEN CharIndex(',',o ptions.optionDe scrip) = 0 THEN
options.optionD escrip LIKE '" & gauge & "%' ELSE
Left(options.op tionDescrip,Cha rIndex(',',opti ons.optionDescr ip)) LIKE
'" & gauge & "%' END)
Thanks for any input you can provide, I appreciate it.
Comment