Board index » delphi » How to Select Only the Fields of 1 Table in a Multi-table Join

How to Select Only the Fields of 1 Table in a Multi-table Join

I'm trying to get retrieve only the columns of 1 table without explicitly
calling out the fields.  If I use the "*" then I get the fields of all the
tables in the join.  This puts me over the max number of columns I can have
in a Paradox table.

Thanks,

Al Willis

 

Re:How to Select Only the Fields of 1 Table in a Multi-table Join


I guess you really got me on this one, if you know  "*" calls all the fields,
why don't you call the individual fields??  Just list the fields you want
separated by commas vs. the asterisk.  Is there something else?
Quote
Al Willis wrote:
> I'm trying to get retrieve only the columns of 1 table without explicitly
> calling out the fields.  If I use the "*" then I get the fields of all the
> tables in the join.  This puts me over the max number of columns I can have
> in a Paradox table.

> Thanks,

> Al Willis

Re:How to Select Only the Fields of 1 Table in a Multi-table Join


Are you using an explicit join cluase in your select?  If not you can do
something like this:

select a.*
  from table1 a, table2 b
where a.field1 = b.fieldx

It works for me.

--jd

Quote
Al Willis wrote in message <7a57fi$k...@forums.borland.com>...
>I'm trying to get retrieve only the columns of 1 table without explicitly
>calling out the fields.  If I use the "*" then I get the fields of all the
>tables in the join.  This puts me over the max number of columns I can have
>in a Paradox table.

>Thanks,

>Al Willis

Re:How to Select Only the Fields of 1 Table in a Multi-table Join


Kevin,

My program must handle about 250 different tables of different table
structures.  I ran into a problem with one of the data fields named
"LENGTH".  This caused a problem in the SQL statement since it was a
reserved word.  Listing the fields individually would expose me to a problem
on any table that might have a reserved word as a fieldname.  I am aware
that I could have enclosed the field names with quote marks, but that caused
me problems elsewhere as I had field names specified as "A.Length".  Then
Paradox could not find the field in the result table.  It did not recognize
the alias "A".  I could work around this, but I was looking for an easier
way.

Thanks,

Al Willis

Quote
Kevin wrote in message <36C6236B.66FAD...@workmail.com>...
>I guess you really got me on this one, if you know  "*" calls all the
fields,
>why don't you call the individual fields??  Just list the fields you want
>separated by commas vs. the asterisk.  Is there something else?

>Al Willis wrote:

>> I'm trying to get retrieve only the columns of 1 table without explicitly
>> calling out the fields.  If I use the "*" then I get the fields of all
the
>> tables in the join.  This puts me over the max number of columns I can
have
>> in a Paradox table.

>> Thanks,

>> Al Willis

Re:How to Select Only the Fields of 1 Table in a Multi-table Join


J.M.,

I was doing an explicit left outer join, but maybe I don't have to.  I will
experiment to find out.

Thanks,

Al Willis

J. M. De Moor wrote in message <7a5q94$1...@forums.borland.com>...

Quote
>Are you using an explicit join cluase in your select?  If not you can do
>something like this:

>select a.*
>  from table1 a, table2 b
>where a.field1 = b.fieldx

>It works for me.

>--jd

>Al Willis wrote in message <7a57fi$k...@forums.borland.com>...
>>I'm trying to get retrieve only the columns of 1 table without explicitly
>>calling out the fields.  If I use the "*" then I get the fields of all the
>>tables in the join.  This puts me over the max number of columns I can
have
>>in a Paradox table.

>>Thanks,

>>Al Willis

Re:How to Select Only the Fields of 1 Table in a Multi-table Join


Quote
>I was doing an explicit left outer join, but maybe I don't have to.  I will
>experiment to find out.

Try

select a.*
from table1 a left outer join table2 b
on a.fielda = b.fieldx

It should still work.

--jd

Re:How to Select Only the Fields of 1 Table in a Multi-table Join


You wish to the impossible
Quote
Al Willis wrote in message <7a57fi$k...@forums.borland.com>...
>I'm trying to get retrieve only the columns of 1 table without explicitly
>calling out the fields.  If I use the "*" then I get the fields of all the
>tables in the join.  This puts me over the max number of columns I can have
>in a Paradox table.

>Thanks,

>Al Willis

Re:How to Select Only the Fields of 1 Table in a Multi-table Join


JD,

Thanks.

Al

J. M. De Moor wrote in message <7a8asb$3...@forums.borland.com>...

Quote

>>I was doing an explicit left outer join, but maybe I don't have to.  I
will
>>experiment to find out.

>Try

>select a.*
>from table1 a left outer join table2 b
>on a.fielda = b.fieldx

>It should still work.

>--jd

Re:How to Select Only the Fields of 1 Table in a Multi-table Join


The following code will solve your problem:

SELECT T2.* FROM MYTABLE1 T1, MYTABLE2 T2
WHERE T1.ID = T2.ID

This will select only the fields from MYTABLE2.

Quote
>I was doing an explicit left outer join, but maybe I don't have to.  I will
>experiment to find out.

Re:How to Select Only the Fields of 1 Table in a Multi-table Join


Thanks Trevor

Al Willis

In article <VA.0000000c.0003deff@bigbairn>,

Quote
  tre...@ges.co.uk wrote:
> The following code will solve your problem:

> SELECT T2.* FROM MYTABLE1 T1, MYTABLE2 T2
> WHERE T1.ID = T2.ID

> This will select only the fields from MYTABLE2.

> >I was doing an explicit left outer join, but maybe I don't have to.  I will
> >experiment to find out.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    

Other Threads