General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
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
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only