> -----Original Message----- > From: Edward Macnaghten [mailto:[EMAIL PROTECTED] > Sent: 28 February 2005 16:47 > To: sqlite-users@sqlite.org > Subject: Re: [sqlite] ticket 1147
> However - having duplicate column names (without aliasing > them), or using an unqualified "*" when querying a select > statement with more than one table in it is really bad > practice - and I do not think the ANSI standard specifies how > that should be dealt with so I do not think sqlite CAN do it > "wrong" in that case. This isn't the only case at issue though. The reason I had to amend my simple Delphi wrapper was to deal with queries such as this one: SELECT Name, Title, Books.ID, Authors.ID FROM Books inner join Authors on Books.AuthorID = Authors.ID ORDER BY Authors.Name, Books.Title; In this case, the query is unambiguous, but by default Sqlite returns the column names as: Name Title ID ID In may case, all I need to do is to execute: PRAGMA full_column_names = 1; and this fixes the problem, even in 3.1.3 (in my limited testing). Of course you could also do: SELECT Name, Title, Books.ID as BooksID, Authors.ID as AuthorsID FROM Books inner join Authors on Books.AuthorID = Authors.ID ORDER BY Authors.Name, Books.Title; but I don't see why you shouldn't use the first approach if you want to. Tim Behlendorf on open source: http://www.itwriting.com/behlendorf1.php