Web Development



how to write a sql query to merge two table and display it in ListView Control in asp.net?

By madanraj ·
I want to merge(JOIN) two tables based on some condition and display that in list-view control....
the problem is both the table contain the attributes with the same name "id","name" and "message" how to display these items separately in item-template....

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Collapse -


by Tony Hopkinson In reply to how to write a sql query ...

well if the columns were the same data (why ???) you'd only select one of them
Select Table1.id,table1.name, table2.someColumn from Table1 Join Table2...

if not you'll have to alias them
Select Table1.id as "Id FromTable1, Table2.id as "Id from table2" ...

There are ways round having to do it, ie using the columns or fields collections and writing the fill code yourself but they are usually more trouble than they are worth.

Related Discussions

Related Forums