Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 6 of 6 total
Thread table names preceding columns names in query
Mon, Apr 16 2007 3:34 PMPermanent Link

Kees Lagendijk
Is there a way to have a query show the table names as well as the column names in the result?

Example:

table 1:

clientNo
name
address

table 2:

clientNo
oderNo
orderAmount

Query:

select * from table1 inner join table2 on table1.clientNo=table2.clientNo

result should be

table1.clientNo  table1.name table1.address table2.clientNo table2.orderNo table2.orderAmount
1000 smith 41 street 1000 12345 1500

It is important that our clients can indentify the table out of which the data is extracted.

Mon, Apr 16 2007 5:19 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Kees,

<< Is there a way to have a query show the table names as well as the column
names in the result? >>

Do this in the TDBISAMQuery component:

In the AfterOpen event handler for the TDBISAMQuery component, loop through
the TFields and set their DisplayLabel value to the Origin property for the
TField.  That will make their titles show up as MyTable.MyColumn, etc.

--
Tim Young
Elevate Software
www.elevatesoft.com

Tue, Apr 17 2007 5:32 AMPermanent Link

Kees Lagendijk

Tim,

This is amazing! We love DBIsam.
But you already knew that Wink

Tx,
Kees
Tue, Apr 17 2007 1:14 PMPermanent Link

Kees Lagendijk
Another question about this topic:

the query goes likes this:

select * from A
inner join B as C on A.clientNo1=C.clientNo
inner join B as D on A.clientNo2=D.clientNo

When following the above mentioned tip the result looks like this:

A.clientNo1, A.clientNo2, B.name, B.name1

Is there any way to replace B with C and D in the result?

Tue, Apr 17 2007 5:34 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Kees,

<< Is there any way to replace B with C and D in the result? >>

That's a little tougher since C and D are only valid in the context of the
query, and I don't think we can change this without making the origins
completely unusable for other purposes.

--
Tim Young
Elevate Software
www.elevatesoft.com

Thu, Apr 19 2007 5:38 AMPermanent Link

Kees Lagendijk

I have solved it by creating temporary copies of the tables involved.

Tx - keep up the good work!
Image