Reputation: 1
We are using this query to get information from the db :-
name=db.executesql('SELECT COUNT(*) FROM tb_name')[0][0]
Any one can please elaborate this. I get same result when i used or not [0][0]
at the end of this query. Can somebody help in understanding the use of [0][0]
in this query.
Upvotes: 0
Views: 49
Reputation: 3699
The executesql
will return a nested list. [0][0]
means that the name
variable will contain the first element inside the first list returned by the query.
Upvotes: 1