Chris Rebert wrote:
> On Tue, Nov 11, 2008 at 12:56 AM, Gilles Ganault <[EMAIL PROTECTED]> wrote:
>> On Mon, 10 Nov 2008 20:02:39 -0600, Andrew <[EMAIL PROTECTED]> wrote:
>>> sql = 'SELECT id FROM master'
>>> rows=list(cursor.execute(sql))
>>> for id in rows:
>>> sql = 'SELECT COUNT(code) FRO
On Tue, Nov 11, 2008 at 12:56 AM, Gilles Ganault <[EMAIL PROTECTED]> wrote:
> On Mon, 10 Nov 2008 20:02:39 -0600, Andrew <[EMAIL PROTECTED]> wrote:
>>sql = 'SELECT id FROM master'
>>rows=list(cursor.execute(sql))
>>for id in rows:
>> sql = 'SELECT COUNT(code) FROM companies WHERE code="%s"' %
On Mon, 10 Nov 2008 20:02:39 -0600, Andrew <[EMAIL PROTECTED]> wrote:
>sql = 'SELECT id FROM master'
>rows=list(cursor.execute(sql))
>for id in rows:
> sql = 'SELECT COUNT(code) FROM companies WHERE code="%s"' % id[0]
> result = list(cursor.execute(sql))
> print "Code=%s, number=%
Andrew <[EMAIL PROTECTED]> writes:
> (47,) is the python representation of a one item tuple
It's also the representation of a one-column result row, which is more
pertinent here.
Just because ‘str(foo) == str(bar)’, does *not* necessarily mean
‘type(foo) == type(bar)’, nor even ‘isinstance(foo,
Ben Finney wrote:
> Gilles Ganault <[EMAIL PROTECTED]> writes:
>
>
>> Hello
>>
>> I'm getting some unwanted result when SELECTing data from an SQLite
>> database:
>>
>> ==
>> sql = 'SELECT id FROM master'
>> rows=list(cursor.execute(sql))
>> for id in rows:
>> sql = 'SELECT COUNT(code)
My apologies, my response was rather confused.
Ben Finney <[EMAIL PROTECTED]> writes:
> The result of an SQL SELECT is a sequence of tuples, where each item
> in the tuple is a value for a column as specified in the SELECT
> clause.
This remains true. No matter how many columns you specify in th
Gilles Ganault <[EMAIL PROTECTED]> writes:
> Hello
>
> I'm getting some unwanted result when SELECTing data from an SQLite
> database:
>
> ==
> sql = 'SELECT id FROM master'
> rows=list(cursor.execute(sql))
> for id in rows:
> sql = 'SELECT COUNT(code) FROM companies WHERE code="%s"' %
Hello
I'm getting some unwanted result when SELECTing data from an SQLite
database:
==
sql = 'SELECT id FROM master'
rows=list(cursor.execute(sql))
for id in rows:
sql = 'SELECT COUNT(code) FROM companies WHERE code="%s"' % id[0]
result = list(cursor.execute(sql))
prin