Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default sql RETRIEVING DATA FROM TWO TABLES

Hi,

I'm trying to retrieve data from two identical tables (different name and
data but same structure) into a Excel sheet.
I'm trying something like
"SELECT DISTINCT LIN07.COCLI, LIN07.DATA, LIN07.CODIART, LIN07.DESCRIPCIO,
LIN07.PREUNET, LIN07.PORTS, LIN07.QUANT
FROM `X:\Geseuro\FAC1`\LIN07.DBF LIN07
UNION
SELECT LIN06.COCLI, LIN06.DATA, LIN06.CODIART, LIN06.DESCRIPCIO,
LIN06.PREUNET, LIN06.PORTS, LIN06.QUANT FROM
`X:\Geseuro\FAC1`\LIN06.DBF LIN06
WHERE (LIN07.CODIART LIKE '50404%') OR (LIN06.CODIART LIKE '50404%')"

It gives me an error : "too few parameters. 1 was expected"

Two questions comes he
1.- Is this a way to do this (retrieving data from 2 tables)?
2.- What's wrong in my sentence?

Thanks for your help.
ramonvi
  #2   Report Post  
Posted to microsoft.public.excel.programming
CLR CLR is offline
external usenet poster
 
Posts: 1,998
Default sql RETRIEVING DATA FROM TWO TABLES

I would try recording a macro while going through the Data Get External
Data Create new Query sequence, twice, once for each table..........that
should at least give you something you can edit...

Vaya con Dios,
Chuck, CABGx3



"ramonvi" wrote:

Hi,

I'm trying to retrieve data from two identical tables (different name and
data but same structure) into a Excel sheet.
I'm trying something like
"SELECT DISTINCT LIN07.COCLI, LIN07.DATA, LIN07.CODIART, LIN07.DESCRIPCIO,
LIN07.PREUNET, LIN07.PORTS, LIN07.QUANT
FROM `X:\Geseuro\FAC1`\LIN07.DBF LIN07
UNION
SELECT LIN06.COCLI, LIN06.DATA, LIN06.CODIART, LIN06.DESCRIPCIO,
LIN06.PREUNET, LIN06.PORTS, LIN06.QUANT FROM
`X:\Geseuro\FAC1`\LIN06.DBF LIN06
WHERE (LIN07.CODIART LIKE '50404%') OR (LIN06.CODIART LIKE '50404%')"

It gives me an error : "too few parameters. 1 was expected"

Two questions comes he
1.- Is this a way to do this (retrieving data from 2 tables)?
2.- What's wrong in my sentence?

Thanks for your help.
ramonvi

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default sql RETRIEVING DATA FROM TWO TABLES

Thanks for your answer, Chuck.

I'm afraid doing so I would have lots of rows since for each row in one
query it adds the number of rows found in 2nd query.

Thanks anyway
ramonvi



"CLR" wrote:

I would try recording a macro while going through the Data Get External
Data Create new Query sequence, twice, once for each table..........that
should at least give you something you can edit...

Vaya con Dios,
Chuck, CABGx3



"ramonvi" wrote:

Hi,

I'm trying to retrieve data from two identical tables (different name and
data but same structure) into a Excel sheet.
I'm trying something like
"SELECT DISTINCT LIN07.COCLI, LIN07.DATA, LIN07.CODIART, LIN07.DESCRIPCIO,
LIN07.PREUNET, LIN07.PORTS, LIN07.QUANT
FROM `X:\Geseuro\FAC1`\LIN07.DBF LIN07
UNION
SELECT LIN06.COCLI, LIN06.DATA, LIN06.CODIART, LIN06.DESCRIPCIO,
LIN06.PREUNET, LIN06.PORTS, LIN06.QUANT FROM
`X:\Geseuro\FAC1`\LIN06.DBF LIN06
WHERE (LIN07.CODIART LIKE '50404%') OR (LIN06.CODIART LIKE '50404%')"

It gives me an error : "too few parameters. 1 was expected"

Two questions comes he
1.- Is this a way to do this (retrieving data from 2 tables)?
2.- What's wrong in my sentence?

Thanks for your help.
ramonvi

  #4   Report Post  
Posted to microsoft.public.excel.programming
CLR CLR is offline
external usenet poster
 
Posts: 1,998
Default sql RETRIEVING DATA FROM TWO TABLES

As part of the Query Wizard, one can filter the data to reduce the number of
rows returned.........

Vaya con Dios,
Chuck, CABGx3



"ramonvi" wrote:

Thanks for your answer, Chuck.

I'm afraid doing so I would have lots of rows since for each row in one
query it adds the number of rows found in 2nd query.

Thanks anyway
ramonvi



"CLR" wrote:

I would try recording a macro while going through the Data Get External
Data Create new Query sequence, twice, once for each table..........that
should at least give you something you can edit...

Vaya con Dios,
Chuck, CABGx3



"ramonvi" wrote:

Hi,

I'm trying to retrieve data from two identical tables (different name and
data but same structure) into a Excel sheet.
I'm trying something like
"SELECT DISTINCT LIN07.COCLI, LIN07.DATA, LIN07.CODIART, LIN07.DESCRIPCIO,
LIN07.PREUNET, LIN07.PORTS, LIN07.QUANT
FROM `X:\Geseuro\FAC1`\LIN07.DBF LIN07
UNION
SELECT LIN06.COCLI, LIN06.DATA, LIN06.CODIART, LIN06.DESCRIPCIO,
LIN06.PREUNET, LIN06.PORTS, LIN06.QUANT FROM
`X:\Geseuro\FAC1`\LIN06.DBF LIN06
WHERE (LIN07.CODIART LIKE '50404%') OR (LIN06.CODIART LIKE '50404%')"

It gives me an error : "too few parameters. 1 was expected"

Two questions comes he
1.- Is this a way to do this (retrieving data from 2 tables)?
2.- What's wrong in my sentence?

Thanks for your help.
ramonvi

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default sql RETRIEVING DATA FROM TWO TABLES

Thinking of it, may next code have to work? (in Sql syntax) and the trouble
is msQuery is limited ?

SELECT COCLI, DATA, CODIART, DESCRIPCIO, PREUNET, PORTS, QUANT
FROM (SELECT 1 AS LIN07.CODIART UNION ALL SELECT 2 AS SELECT LIN06.CODIART )
WHERE CODIART Like '50404%'


Thanks for the help.
ramonvi

"ramonvi" wrote:

Thanks for your answer, Chuck.

I'm afraid doing so I would have lots of rows since for each row in one
query it adds the number of rows found in 2nd query.

Thanks anyway
ramonvi



"CLR" wrote:

I would try recording a macro while going through the Data Get External
Data Create new Query sequence, twice, once for each table..........that
should at least give you something you can edit...

Vaya con Dios,
Chuck, CABGx3



"ramonvi" wrote:

Hi,

I'm trying to retrieve data from two identical tables (different name and
data but same structure) into a Excel sheet.
I'm trying something like
"SELECT DISTINCT LIN07.COCLI, LIN07.DATA, LIN07.CODIART, LIN07.DESCRIPCIO,
LIN07.PREUNET, LIN07.PORTS, LIN07.QUANT
FROM `X:\Geseuro\FAC1`\LIN07.DBF LIN07
UNION
SELECT LIN06.COCLI, LIN06.DATA, LIN06.CODIART, LIN06.DESCRIPCIO,
LIN06.PREUNET, LIN06.PORTS, LIN06.QUANT FROM
`X:\Geseuro\FAC1`\LIN06.DBF LIN06
WHERE (LIN07.CODIART LIKE '50404%') OR (LIN06.CODIART LIKE '50404%')"

It gives me an error : "too few parameters. 1 was expected"

Two questions comes he
1.- Is this a way to do this (retrieving data from 2 tables)?
2.- What's wrong in my sentence?

Thanks for your help.
ramonvi

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Retrieving info from multiple tables PMaravy Excel Discussion (Misc queries) 1 October 10th 08 05:15 PM
retrieving data Jess Excel Worksheet Functions 1 February 13th 07 04:54 PM
Retrieving Data from Excel Pivot tables into Datatable Chelvy Excel Programming 0 July 8th 06 12:10 AM
Retrieving Web Data leafsfan1967[_6_] Excel Programming 6 June 25th 05 06:47 PM
Retrieving data Alan M[_2_] Excel Programming 5 March 24th 05 12:27 PM


All times are GMT +1. The time now is 08:02 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"