Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL inner join incorrect results
Message
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
SQL inner join incorrect results
Divers
Thread ID:
01158594
Message ID:
01158594
Vues:
70
I have an inherited system with a SQL database, and in it is a stored procedure that has the following query:
select catalog.cat_type_code,catalog.cat_id, catalog.cat_title, catalog.cat_phase_code, catalog.cat_active_yn,
TEST_PROFILE.test_pro_status
FROM CATALOG INNER JOIN TEST_PROFILE
ON TEST_PRO_CAT_ID = CAT_ID
where  cat_active_yn = 'Y'
and test_pro_status = 'L'
and cat_type_code in ('PRE', 'T')
and cat_sponser_cd = 'DCF'
The number of records returned is correct, but the field "cat_phase_code" should have one of two values, either "PH1" or "CWT". In the query results all cat_phase_code fields contain "PH1".

I know it has something to do with the join, because if I remove it, the query returns the correct values per record.

Does anything blatantly wrong stick out at anyone? I've been playing with it to no avail.

Thanks!
KP
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform