S
sebastico
I have 2 sql
The First
SELECT G05_LacGastIngr.CodProd, G05_LacGastIngr.CodPer,
G05_LacGastIngr.CodLac, Sum(G05_LacGastIngr.Cantidad) AS Cantidad
FROM G05_LacGastIngr
WHERE (((G05_LacGastIngr.CodGastIngr) In ("2")))
GROUP BY G05_LacGastIngr.CodProd, G05_LacGastIngr.CodPer,
G05_LacGastIngr.CodLac
HAVING (((G05_LacGastIngr.CodLac)="1"));
The Second
SELECT [7AreaFinca].CodProd, [7AreaFinca].CodPer, [7AreaFinca].AreaTotal
FROM 7AreaFinca
WHERE ((([7AreaFinca].CodPer)="11"));
The Division qry First/Second
SELECT tabla1.CodProd, tabla1.CodPer, tabla1.CodLac,
[tabla1].[leche/vaca]/[tabla2].[AreaTotal] AS [Produccion/Vaca]
FROM (SELECT G05_LacGastIngr.CodProd, G05_LacGastIngr.CodPer,
G05_LacGastIngr.CodLac, Sum(G05_LacGastIngr.Cantidad) AS Cantidad
FROM G05_LacGastIngr
WHERE (((G05_LacGastIngr.CodGastIngr) In ("2")))
GROUP BY G05_LacGastIngr.CodProd, G05_LacGastIngr.CodPer,
G05_LacGastIngr.CodLac
HAVING (((G05_LacGastIngr.CodLac)="1"));
).AS Tabla1, (SELECT [7AreaFinca].CodProd, [7AreaFinca].CodPer,
[7AreaFinca].AreaTotal
WHERE ((([7AreaFinca].CodPer)="11"));
FROM 7AreaFinca
).AS Tabla2
WHERE (((tabla1.CodProd)=[tabla2].[codprod]) AND
((tabla1.CodPer)=[tabla2].[codper]) AND ((tabla1.CodLac)=[tabla2].[codlac]));
However, when I run the Query (division) the message "Syntax error in FROM
clause"is displayed. I have been checking the syntax and I can not find the
mistake. How do I fix the error?Could you help me?
I would like to share my experience with division operation:
I did a couple of division and they work.
If I copy and paste the syntax of a working qry to a new query it doesn't
work. Seems to be copy and paste is no good idea to create a new sql.
Many thanks
The First
SELECT G05_LacGastIngr.CodProd, G05_LacGastIngr.CodPer,
G05_LacGastIngr.CodLac, Sum(G05_LacGastIngr.Cantidad) AS Cantidad
FROM G05_LacGastIngr
WHERE (((G05_LacGastIngr.CodGastIngr) In ("2")))
GROUP BY G05_LacGastIngr.CodProd, G05_LacGastIngr.CodPer,
G05_LacGastIngr.CodLac
HAVING (((G05_LacGastIngr.CodLac)="1"));
The Second
SELECT [7AreaFinca].CodProd, [7AreaFinca].CodPer, [7AreaFinca].AreaTotal
FROM 7AreaFinca
WHERE ((([7AreaFinca].CodPer)="11"));
The Division qry First/Second
SELECT tabla1.CodProd, tabla1.CodPer, tabla1.CodLac,
[tabla1].[leche/vaca]/[tabla2].[AreaTotal] AS [Produccion/Vaca]
FROM (SELECT G05_LacGastIngr.CodProd, G05_LacGastIngr.CodPer,
G05_LacGastIngr.CodLac, Sum(G05_LacGastIngr.Cantidad) AS Cantidad
FROM G05_LacGastIngr
WHERE (((G05_LacGastIngr.CodGastIngr) In ("2")))
GROUP BY G05_LacGastIngr.CodProd, G05_LacGastIngr.CodPer,
G05_LacGastIngr.CodLac
HAVING (((G05_LacGastIngr.CodLac)="1"));
).AS Tabla1, (SELECT [7AreaFinca].CodProd, [7AreaFinca].CodPer,
[7AreaFinca].AreaTotal
WHERE ((([7AreaFinca].CodPer)="11"));
FROM 7AreaFinca
).AS Tabla2
WHERE (((tabla1.CodProd)=[tabla2].[codprod]) AND
((tabla1.CodPer)=[tabla2].[codper]) AND ((tabla1.CodLac)=[tabla2].[codlac]));
However, when I run the Query (division) the message "Syntax error in FROM
clause"is displayed. I have been checking the syntax and I can not find the
mistake. How do I fix the error?Could you help me?
I would like to share my experience with division operation:
I did a couple of division and they work.
If I copy and paste the syntax of a working qry to a new query it doesn't
work. Seems to be copy and paste is no good idea to create a new sql.
Many thanks