简体   繁体   中英

Refering to columns from more tables having the same attribute name

When using SQLite database from Javascript you will use the following statement to get the title from database column of table T .

while (statement.executeStep())
{
  title = statement.row.title;
}

How would you refer to title if it originates from two tables T1 and T2 ? Both of them have title attribute and in the SQL statement I use dot notation as follows:

select T1.title, T2.title from ...

You could try to give them different names on the SQL query:

SELECT T1.title as title1, T2.title as title2 FROM ...

Hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM