Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Why this query doesn't return all Queue records?
Message
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Why this query doesn't return all Queue records?
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01078686
Message ID:
01078686
Vues:
47
Hi everybody,

Here is the query
SELECT CAST(NVL(COUNT(*), 0) as Numeric(5,0)) as nCount, ;
	Queue_Names.cQueue_Names_pk, Queue_Names.cQueue_Name, 
	Trans.cDepartment_Code
	FROM Queue_Names
	LEFT JOIN Trans_Employees_Queues on 
	Queue_Names.cQueue_Names_pk = Trans_Employees_Queues.cQueue_Names_fk 
	LEFT JOIN Trans on Trans.cTrans_pk = Trans_Employees_Queues.cTrans_fk	
	where Queue_Names.iActive_Flag = 1 and Trans_Employees_Queues.iActive_Flag = 1 
	group by 2,3,4
It returns only 3 records for the 3 queue names I have in Trans_Employees_Queues table. I would expect it to return all possible queue names from Queue Names table with 0 as count. Do you see what's the error in my logic?

Thanks in advance.

Ok, now I think I see it myself. I should not group by Department code or how should I modify it? Simple - by using either Trans department code or by using Queue department code, since we have it in both tables.
If it's not broken, fix it until it is.


My Blog
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform