python - database field value that matches to every query -
i insert records sqlite database fields such every query specifies value field not disqualify record.
make model engine parameter ford * * 1 ford taurus * 2 ford escape * 3
so query = (database.table.make == ford') & (database.table.model == 'taurus') return first 2 records
edit: woot, decided use following: (database.table.make.belongs('ford','')) & (database.table.model.belongs('taurus','')) syntax in operator in web2py
are looking this? won't perform due or
s if have lot of rows.
select * cars ( cars.make = 'ford' or cars.make = '*' ) , ( cars.model = 'taurus' or cars.model = '*' )
if meant use null
, can replace , replace or condition or cars.make null
, etc.
or make maybe little less verbose:
select * cars cars.make in ('ford','*') , cars.model in ('taurus','*')
but wouldn't able use null in case , have use *
token.
Comments
Post a Comment