简体   繁体   中英

How to display results from two different tables with the same column names

I have this query:

SELECT titulo, info FROM htmlcss, php ORDER BY date

I get Column 'titulo' in field list is ambiguous How do I fix this?

Include the table name. If you want titulo from htmlcss:

SELECT htmlcss.titulo, info FROM htmlcss, php ORDER BY date

You can select both if you want:

SELECT htmlcss.titulo, php.titulo, info FROM htmlcss, php ORDER BY date
SELECT a.titulo, b.info FROM htmlcss a 
    inner join php b on a.titulo=b.titulo  ORDER BY date

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