user673453
user673453

Reputation: 167

How to identify the column name of a data table

I have got a datatable with records from two different database tables. Each of the database tables have a column with the same name(eg: ID). The datatable generated will display the field ID of the two tables as ID and ID1. I need to sort the datatable with the ID of the second table. How can I identify which column of the datatable is the ID of the second table.

Upvotes: 0

Views: 386

Answers (1)

vvk
vvk

Reputation: 823

You can specify the name of the columns in the SQL query

SELECT 
  FT.ID FIRSTTABLE_ID,
  ST.ID SECONDTABLE_ID
FROM FIRSTTABLE FT, SECONDTABLE ST
WHERE FT.ID = ST.FS_ID

Upvotes: 2

Related Questions