Question

I am trying the following query to read from multiple dbf files in the same folder:

"SELECT COMPNO FROM REF10,REF11,REF12,REF08,REF09 WHERE SR_NO='RDDFT000108'";

The above generates the following error:

"The specified field 'COMPNO' could refer to more than one table listed in the FROM clause of your SQL statement."

How can I refer more than one tables in the same query?

Was it helpful?

Solution

try with UNION

SELECT COMPNO  FROM REF10 WHERE SR_NO='RDDFT000108';
UNION ALL;
SELECT COMPNO  FROM REF11 WHERE SR_NO='RDDFT000108';
UNION;
SELECT COMPNO  FROM REF12 WHERE SR_NO='RDDFT000108';
UNION;
SELECT COMPNO  FROM REF08 WHERE SR_NO='RDDFT000108';
UNION;
SELECT COMPNO  FROM REF09  WHERE SR_NO='RDDFT000108';

OTHER TIPS

You should use table definitions in the query text:

"SELECT REF10.COMPNO, REF11.COMPNO, REF12.COMPNO, REF08.COMPNO, REF09.COMPNO FROM REF10,REF11,REF12,REF08,REF09 WHERE SR_NO='RDDFT000108'";
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top