python - Trouble with a simple query PyODBC -
i want query following:
the attribute unknown hrs yes if employee works on @ least 1 project null hours, , no otherwise.
and first making list, thelist containing relevant social security numbers , consequently:
for in thelist:
unknown_hours=process_query("select distinct count(*) works_on isnull(hours) , essn='%s'" %i)
temp.append(unknown_hours)
the trouble answers 1l or 0l , need them integers (for algorithm). thoughts?
regards cenderze
1l
long integer representation of integer value 1
:
>> type(1l) <type 'long'> >>> long(1) 1l >>> int(1l) 1
convert in python:
int(unknown_hours)
or in database layer:
select distinct cast(count(*) unsigned) works_on isnull(hours) , essn='%s'
Comments
Post a Comment