[AccessD] query select in column

rockysmolin at bchacc.com rockysmolin at bchacc.com
Thu Dec 29 10:25:26 CST 2011


At this point I would do a temp table with  a bit of code - start by
creating a table of all PATs with at least oe 325 record, with extra
yes/no fields for 326 and 327.  Loop through the records noting 326 and
327 records for PATs already in the table. 

Rocky  

-------- Original Message --------
Subject: Re: [AccessD] query select in column
From: "Gustav Brock" <Gustav at cactus.dk>
Date: Thu, December 29, 2011 8:49 am
To: <accessd at databaseadvisors.com>

Hi Pedro

Perhaps a union query will do:

Select tbl2.pat, tbl2.opendate, tbl2.code from tbldialysis as tbl2
inner join 
(select distinct pat from tbldialysis where code=325) as tbl1 
on tbl1.pat = tbl2.pat 
where tbl2.code in (326,327)
union all
Select tbl2.pat, tbl2.opendate, tbl2.code from tbldialysis as tbl2 
inner join 
(select distinct pat from tbldialysis where code in (326,327) as tbl1 
on tbl1.pat = tbl2.pat 
where tbl2.code=325;

/gustav


>>> pedro at plex.nl 29-12-2011 14:54 >>>
Hello William,

I made a second table with only the code=325 records in it.
But i get an syntax-error when using the query;

Select tbl2.pat, tbl2.opendate, tbl2.code from tbldialysis as tbl2 inner
join (select distinct pat from tbldialysis where code=325) as tbl1 on
tbl1.pat = tbl2.pat and tbl2.code in (326,327);

i can't figure out why (after correction of misspelled words?

What am i doing wrong?

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