Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

ok here's my request for now:

SELECT tblUser.Nom, tblUser.Prenom, Sum(CréditsDeVente) as somme, tblUser.Societe, tblUser2.Nom, tblUser2.Prenom 
FROM tblUser, tblIndividus, tblProjet, tblUser as tblUser2 
WHERE tblProjet.ProjetIndividu=tblIndividus.NomPrénom 
AND tblIndividus.IndividuChargéDeCompte=tblUser2.index 
AND tblIndividus.IndividuRessAffairesEst=tblUser.index 
AND Statut="Terminé - succès" 
GROUP BY tblUser.Nom, tblUser.Prenom, tblUser.Societe, tblUser2.Nom, tblUser2.Prenom 
ORDER BY Sum(CréditsDeVente) DESC, tblUser.Societe, tblUser.Nom, tblUser.Prenom

 

but there is juste a problem, I want the data from the Individus who dont have a ChargéDeCompte in other words, all the data from wich this part: "AND tblIndividus.IndividuChargéDeCompte=tblUser2.index " does not exist.

 

can anyone help me out on there? if you need more info ask... ill put an exemple soon...

  • *Experts*
Posted

You'll want to add something like this to the where clause:

AND NOT EXISTS 
(
	SELECT * FROM tblIndividus WHERE IndividuChargéDeCompte = tblUser2.index
)

 

-ner

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Posted

MS-SQL, ACCESS, DB2, Sybase, Oracle 10g, this will work. . . and much faster than the not exists.

 

wont work in Oracle 9 or earlier

 

 

SELECT u1.Nom,

u1.Prenom,

Sum(CréditsDeVente) as somme,

u1.Societe,

u2.Nom,

u2.Prenom

FROM

( ( tblIndividus i inner join tblProjet p

on i.NomPrénom = p.ProjetIndividu)

inner join tblUser u1

on u1.index = i.IndividuRessAffairesEst

)

left outer join tblUser u2

on u2.Index = i.IndividuRessAffairesEst

 

where Statut="Terminé - succès" and u2.index is null

 

GROUP BY u1.Nom, u1.Prenom, u1.Societe, u2.Nom, u2.Prenom

ORDER BY Sum(CréditsDeVente) DESC, u1.Societe, u1.Nom, u1.Prenom

Joe Mamma

Amendment 4: The right of the people to be secure in their persons, houses, papers, and effects, against unreasonable searches and seizures, shall not be violated, and no warrants shall issue, but upon probable cause, supported by oath or affirmation, and particularly describing the place to be searched, and the persons or things to be seized.

Amendment 9: The enumeration in the Constitution, of certain rights, shall not be construed to deny or disparage others retained by the people.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...