C code SQL query fixes to reflect the data model changes in issue https://github.com/NAVADMC/SpreadModel/issues/193.