[AccessD] query grouping problem

pedro at plex.nl pedro at plex.nl
Thu Dec 16 15:42:12 CST 2010


Hello Gustav,

exact what is needed.
Works perfect.

Thanks

Pedro



In antwoord op:

> From: "Gustav Brock" <Gustav at cactus.dk>
> To: <pedro at plex.nl>
> Date: Thu, 16 Dec 2010 14:37:07 +0100
> Subject: Re: [AccessD] query grouping problem
> 
> 
> Hi Pedro
> 
> OK, that was another story.
> 
> I think you will need two subqueries:
> 
> Select Distinct * From tblYourTable Where Code1=1 And Code2 Is Null
> Select Distinct * From tblYourTable Where Code2=1 And Code1 Is Null
> 
> Now, inner-join these on PatNr and Date.
> 
> /gustav
> 
> 
> >>> <pedro at plex.nl> 16-12-2010 12:56 >>>
> Hello Gustav,
> 
> That query even i can put together
> Indeed you need more info.
> 
> In the table there are more then hundred thousand record, in al sort combinations.
> 
> I Need the two records where PatNr and Date is the same and where code 1 has value1 (code2 in that record is empty) and in the other record Code2 has a value of 1 (code1 then is empty).
> 
> Thanks
> 
> Pedro
> 
> 
> 
> 
> In antwoord op:
> 
> > From: "Gustav Brock" <Gustav at cactus.dk>
> > To: <accessd at databaseadvisors.com>
> > Date: Thu, 16 Dec 2010 12:31:13 +0100
> > Subject: Re: [AccessD] query grouping problem
> > 
> > 
> > Hi Pedro
> > 
> > That's easy:
> > 
> > Select * From tblYourTable Where [Date]=#2010-02-02#
> > 
> > Or do we need some more info from you?
> > 
> > /gustav
> > 
> > 
> > >>> pedro at plex.nl 16-12-2010 11:57 >>>
> > Dear List,
> > 
> > i have the following table:
> > 
> > ID    PatNr   Date          Name      code1       code2
> > 1      01     1-1-2010      A           1          1
> > 2      01     2-2-2010      B           1                       
> > 3      01     2-2-2010      C                      1
> > 4      02     5-1-2010      A                      1
> > 5      02     5-1-2010      C                      1
> > 
> > I need:
> > 
> > 2      01     2-2-2010      B            1                       
> > 3      01     2-2-2010      C                      1
> > 
> > 
> > I tried several query's with groups on PatNr and Date, but i don't get it done.
> > Who can help me?
> > 
> > Thanks 
> > 
> > Pedro
> 
> 
> 
> 



More information about the AccessD mailing list