Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.
In summary to query SMS from the Admin fron end you enter a psuedo language called WQL. This is translated, by SMS into SQL and the original WQL and its translated SQL is stored in an SMS table called Collection_Rules_SQL.
Thus you can learn the mapping that SMS is doing from WQL to SQL and if required update the SQL directly.
------------------------------------------------------------------------------------------------------
The link to the source of this page seems to be broken, so a copy of the article is below: