Not sure of the syntax for your specific language, but remember that this is a regular select statement. It's going to return 0 to many rows, each with 1 or more columns. YOU know that this "should" return 1 row with 1 column, but the library doesn't know that. So treat it like a normal query to fetch data. Get the first row returned, and look at the first column of that row, and that's where your 0/1 value is going to be.