Information générale
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Query gives wrong results
Hi All,
I have a very simple query that is giving bad results. The data that appears in some of the fields in not the same as the data that is in the actual tables.
SELECT PROJ.user_proj_no, ;
PROJ.sold_by, ;
PROJ_SEG.select, ;
SEGMENT.employeur, ;
PROJ_SEG.proj_mgr_no, ;
PROJ.PROJ_NO ;
FROM main_one!PROJ LEFT OUTER JOIN main_one!PROJ_SEG ;
ON PROJ.proj_no = PROJ_SEG.proj_no ;
LEFT OUTER JOIN main_one!SEGMENT ;
ON PROJ.sold_by = SEGMENT.seg_no ;
WHERE PROJ_SEG.select = 1 ;
AND PROJ_SEG.proj_mgr_no = 0 ;
AND PROJ.sold_by > 0 ;
AND !ISNULL(PROJ.po_dt) ;
AND SEGMENT.employeur = 1 ;
GROUP BY PROJ.user_proj_no, SEGMENT.employeur ;
ORDER BY SEGMENT.employeur, PROJ.user_proj_no
the result gives:
01081, 14, 1, 1, 0, 5356
01247, 12, 1, 1, 0, 5585
The tables show:
01081, 14, 0, 1, 0, 5356 <- field 'select' shows 0
01247, 12, 1, 1, 435, 5585 <- field proj_mgr_no shows 435
Which means that I should not get any records.
Any body have an idea? Is the table header corrupt?
TIA
Mike
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement