Strange Sql statement behaviour 
Author Message
 Strange Sql statement behaviour

I'm quite sure that I'm missing something really stupid, but here it goes:

This query
"SELECT detalbcli.unidades, detalbcli.serie, detalbcli.npedido
FROM (detalbcli INNER JOIN detpedcli ON (detalbcli.numped=detpedcli.npedido)
AND (detalbcli.serieped=detpedcli.serie AND
DETALBCLI.CODIGO1=DETPEDCLI.CODIGO1)) INNER JOIN CABPEDCLI ON
(CABPEDCLI.SERIE=DETPEDCLI.SERIE) AND (CABPEDCLI.NPEDIDO=DETPEDCLI.NPEDIDO)
AND (CABPEDCLI.SERIE=DETALBCLI.SERIEPED) AND
(CABPEDCLI.NPEDIDO=DETALBCLI.NUMPED)
WHERE detALBcli.codigo1='RP1005' and detpedcli.codigo1='RP1005' AND
CABPEDCLI.SITUACION='P';"

returns 2 rows.

This query
"SELECT detalbcli.unidades, detalbcli.serie, detalbcli.npedido
FROM (detalbcli INNER JOIN detpedcli ON (detalbcli.numped=detpedcli.npedido)
AND (detalbcli.serieped=detpedcli.serie AND
DETALBCLI.CODIGO1=DETPEDCLI.CODIGO1)) INNER JOIN CABPEDCLI ON
(CABPEDCLI.SERIE=DETPEDCLI.SERIE) AND (CABPEDCLI.NPEDIDO=DETPEDCLI.NPEDIDO)
AND (CABPEDCLI.SERIE=DETALBCLI.SERIEPED) AND
(CABPEDCLI.NPEDIDO=DETALBCLI.NUMPED)
WHERE detALBcli.codigo1='RP1005' and detpedcli.codigo1='RP1005'"

returns a single row.

I want to include WHERE CABPEDCLI.SITUACION='P', but I expect only one row.
Please someone explain what I'm doing wrong!.
BTW, there are two rows in 'detpedcli' and one row in 'detalbcli' that are
coincident, so it should always return 2 rows.



Tue, 14 Oct 2003 17:38:02 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Strange SQL behaviour!?

2. strange data control behaviour with DAO 3.6 and SQL server

3. strange parameter error in SQL statement

4. strange parameter error in SQL statement

5. strange behaviour of a subform, or a bug?

6. Strange Access behaviour or Bug, or what ?!?

7. Strange Behaviour

8. Strange behaviour of toolbars

9. XP users - Strange date behaviour

10. Strange behaviour in Word

11. DT Picker Control on Multi Page - Strange Behaviour

12. Public folders strange behaviour ?

 

 
Powered by phpBB® Forum Software