JW - added where clause to sqlite view creation