Verdant
Verdant

Reputation: 288

Sqlite prefix columns name

in my project, I use a sqlite database. When I perform a query, I use sqlite3_column_name(compiledStatement, i) to get the name of a column, and fetch the result in a NSArray of NSDictionnaries.

But when I use joins, I have some ambiguous columns name, and SQLITE doesn't anything. Is there a way to get prefixed columns name to avoid this?

Upvotes: -1

Views: 798

Answers (1)

CL.
CL.

Reputation: 180300

You can rename output columns:

SELECT a.x AS ax,
       b.x AS bx,
       [...]
FROM a JOIN B ...

Upvotes: 1

Related Questions