I'm working with MSAccess that say me:
[Microsoft][Controller ODBC Microsoft Access];The join expression not supported.
This is the question:
SELECT
productos.codig_producto,
productos.marca,
productos.descripcion,
stock_mensual.prec_costo,
stock_mensual.prec_venta,
stock_mensual.cantid_inicial,
stock_mensual.cantid_actual,
stock_mensual.costo,
stock_mensual.ingreso
FROM productos INNER JOIN stock_mensual
ON productos.codig_producto=stock_mensual.codig_producto
AND codig_producto='123'
AND mes=7
AND anio=2012;
Data types:
String productos.codig_producto
String stock_mensual.codig_producto
int mes
int anio
SELECT
productos.codig_producto,
productos.marca,
productos.descripcion,
stock_mensual.prec_costo,
stock_mensual.prec_venta,
stock_mensual.cantid_inicial,
stock_mensual.cantid_actual,
stock_mensual.costo,
stock_mensual.ingreso
FROM productos,stock_mensual
Where productos.codig_producto=stock_mensual.codig_producto
AND codig_producto=123
AND mes=7
AND anio=2012;
hope it helps..
Marked as answer by onlycparra on Jul 29, 2012 10:00 PM
Please remember to click “Mark as Answer” on the post that helps you and to unmark it if a marked post does not actually answer your question.
Thank you!
----------------------
"Microsoft Community Contributor Award 2011"
oh!, I'm sorry, codig_producto is string, not an int, excuse me, it is string, I think it is a problem with the join, maybe a pear of ()... it will become me crazy… thanks for your answers, I try whith a Cartesian product but it give me falses numbers in the
other fields.
yes, verified, both are Strings, in access it is "text", does the text size could influence?, maby it is not permitted a long text... something like the "memo" datatype..., I'm going to reduce it and after I tell you about.
I don't work with Access but based on the error message, maybe you have to join your tables in the where clause.
jajaja, I had not understood that, the correct sentence seems to be:
SELECT productos.codig_producto,
productos.marca,
productos.descripcion,
stock_mensual.prec_costo,
stock_mensual.prec_venta,
stock_mensual.cantid_inicial,
stock_mensual.cantid_actual,
stock_mensual.costo,
stock_mensual.ingreso
FROM productos INNER JOIN stock_mensual
ON productos.codig_producto=stock_mensual.codig_producto
WHERE stock_mensual.codig_producto='123'
AND stock_mensual.mes=7
AND stock_mensual.anio=2012;
The problem was that there are not WHERE clause...
And...
atlumer07
Try using cartesian instead of usual joins..
Yes, it really works, the "spurious tuple" was other problem with an assign... plop!
Thanks, really, to all. :)
Marked as answer by onlycparra on Jul 29, 2012 10:00 PM
onlycparra
Member
2 Points
4 Posts
What is wrong in this SQL question?
Jul 28, 2012 08:45 PM|LINK
I'm working with MSAccess that say me:
[Microsoft][Controller ODBC Microsoft Access];The join expression not supported.
This is the question:
SELECT
productos.codig_producto,
productos.marca,
productos.descripcion,
stock_mensual.prec_costo,
stock_mensual.prec_venta,
stock_mensual.cantid_inicial,
stock_mensual.cantid_actual,
stock_mensual.costo,
stock_mensual.ingreso
FROM productos INNER JOIN stock_mensual
ON productos.codig_producto=stock_mensual.codig_producto
AND codig_producto='123'
AND mes=7
AND anio=2012;
Data types:
String productos.codig_producto
String stock_mensual.codig_producto
int mes
int anio
Dan Bracuk
Contributor
3970 Points
1096 Posts
Re: What is wrong in this SQL question?
Jul 28, 2012 08:55 PM|LINK
I don't work with Access but based on the error message, maybe you have to join your tables in the where clause.
Primillo
Star
8723 Points
1677 Posts
Re: What is wrong in this SQL question?
Jul 28, 2012 10:40 PM|LINK
Hi
Try adding the "ORDER BY"
http://www.w3schools.com/sql/sql_join_inner.asp
Primillo
http://www.facebook.com/programandopuntonet
atlumer07
Member
188 Points
61 Posts
Re: What is wrong in this SQL question?
Jul 29, 2012 01:34 AM|LINK
Hi onlycparra,
Try using cartesian instead of usual joins..
maybe this query can help.
SELECT
productos.codig_producto,
productos.marca,
productos.descripcion,
stock_mensual.prec_costo,
stock_mensual.prec_venta,
stock_mensual.cantid_inicial,
stock_mensual.cantid_actual,
stock_mensual.costo,
stock_mensual.ingreso
FROM productos,stock_mensual
Where productos.codig_producto=stock_mensual.codig_producto
AND codig_producto=123
AND mes=7
AND anio=2012;
hope it helps..
santa_1975
Star
8574 Points
1499 Posts
Re: What is wrong in this SQL question?
Jul 29, 2012 05:14 AM|LINK
Hi,
Your query looks okay except that you need to modify the below line,
AND codig_producto='123'
to this (remove quotes) because you've mentioned that "cdig_prducto" is of "int" type.
AND codig_producto=123
Refer to the below link for more information on the INNER JOIN.
http://msdn.microsoft.com/en-us/library/office/bb208854(v=office.12).aspx
Hope this helps.
Thank you!
----------------------
"Microsoft Community Contributor Award 2011"
onlycparra
Member
2 Points
4 Posts
Re: What is wrong in this SQL question?
Jul 29, 2012 12:58 PM|LINK
CPrakash82
All-Star
18152 Points
2830 Posts
Re: What is wrong in this SQL question?
Jul 29, 2012 01:37 PM|LINK
I am just wondering, if your both table has correct datatype for the column - codig_producto ? Please verify
onlycparra
Member
2 Points
4 Posts
Re: What is wrong in this SQL question?
Jul 29, 2012 08:39 PM|LINK
yes, verified, both are Strings, in access it is "text", does the text size could influence?, maby it is not permitted a long text... something like the "memo" datatype..., I'm going to reduce it and after I tell you about.
onlycparra
Member
2 Points
4 Posts
Re: What is wrong in this SQL question?
Jul 29, 2012 10:00 PM|LINK
jajaja, I had not understood that, the correct sentence seems to be:
SELECT productos.codig_producto,
productos.marca,
productos.descripcion,
stock_mensual.prec_costo,
stock_mensual.prec_venta,
stock_mensual.cantid_inicial,
stock_mensual.cantid_actual,
stock_mensual.costo,
stock_mensual.ingreso
FROM productos INNER JOIN stock_mensual
ON productos.codig_producto=stock_mensual.codig_producto
WHERE stock_mensual.codig_producto='123'
AND stock_mensual.mes=7
AND stock_mensual.anio=2012;
The problem was that there are not WHERE clause...
And...
Yes, it really works, the "spurious tuple" was other problem with an assign... plop!
Thanks, really, to all. :)