Question

Locked

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.

2 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Collapse -

Hmmm

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
e.g
Select Table1.id,table1.name, table2.someColumn from Table1 Join Table2...

if not you'll have to alias them
e.g
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.

Back to Web Development Forum
2 total posts (Page 1 of 1)  

Related Discussions

Related Forums