[AccessD] query select in column

William Benson vbacreations at gmail.com
Thu Dec 29 06:53:46 CST 2011


Join the table to a select query whose only criterion is code =25.

Select tb2.pat , tbl2.opendate , tbl2.code from tbldialysis as tb2 inner
join (select distict pat from tbldialysis where  code= 325) as tbl1 on
tbl1.pat = tbl2.pat and tbl2.code in (326,327)
On Dec 29, 2011 6:59 AM, <pedro at plex.nl> wrote:

> Dear list.
>
> i have a table with patients.
>
> tblDialysis
>
> Pat      OpenDate      Code
> 1        01-01-2011    325
> 2        02-02-2011    325
> 2        03-03-2011    326
> 2        04-04-2011    327
> 3        05-05-2011    325
> 3        06-06-2011    326
> 4        07-07-2011    325
> 4        08-08-2011    327
> 5        09-09-2011    326
>
> i need all records of patients who have a code 325 and 326  0r 325 and 327
>
>
> result
>
> Pat      OpenDate      Code
> 2        02-02-2011    325
> 2        03-03-2011    326
> 2        04-04-2011    327
> 3        05-05-2011    325
> 3        06-06-2011    326
> 4        07-07-2011    325
> 4        08-08-2011    327
>
> any idea's
>
> Pedro
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>



More information about the AccessD mailing list