I want to filter the values here for say columnA, then by columnB etc, however I would like that if the filter valueA is simply an emptystring, that no filtering occurs and all values are accepted. The same for say valueB if that were empty then no filtering would occur.
This is a generic mysql query, where I would hope to only filter when the valueA or valueB (inclusive or) has a value that is not null, whitespace or empty string.
using (var cmd = new MySqlCommand(
" SELECT columnA, columnB etc
" FROM table" +
" WHERE columnA = '" + valueA + "' " +
" THEN BY columnB = '" + valueB + "' " +
" GROUP BY columnA" +
" LIMIT 0, 100",
connection))
You can use simple
ORlogic, and checking on the C# side for whitespace is easierPerformance may not be great on large tables, so you may need to use completely separate queries