On 2016/07/21 11:20 PM, Chris Locke wrote:
I've a table I'm calling recursively.

...

I know I can change my SQL statement to be explicit, and select each
required field and use AS, but is that the only solution?

It's not so much the "Only" way as it is the "Correct" way. Query planners between different engines all pop different values into the column name bit returned according to what uses the least CPU cycles (but perhaps still indicate the nature of the column) - which is the way we all want it. Once you actually NEED the names to be specifically something (as in your case) then the SQL standard provides for that by specifying that the Query engine *must* return an exact column name where you specify an "AS" clause for a selected column.

Hence me saying that this is not so much the /only/ way as it is the /correct/ way to ensure your column names are ALWAYS returned exactly as you asked for it.

As to your question about it being the Only way? - No - another way would be to use a different SQL engine that returns something that you like better, or an older version of SQLite when it behaved differently, or put your query in a CTE with named columns - but these ways are all silly for obvious reasons. Do the "AS" thing - it's how the the rest of us roll... :)

Cheers,
Ryan

_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to