sorry mark let me correct myself your query works jus fine and yes indeed it is a remarkable job for the information that I have provided. since you have already provided a working query let not bother about sample data.
however, when I try to get only records that has "commoncolumns" with value more than 1, then I get that conversion error.
how can I get through this? thank you again.