Revision [434]

Last edited on 2010-12-14 14:28:18 by SethKrieger
Additions:
WHERE trantype = 'S' AND amount > 0
AND ptnum = a.ptnum
AND trandate BETWEEN '2008-01-01' AND '2008-12-31') > 0
Deletions:
WHERE trantype = 'S' AND amount > 0 AND trandate BETWEEN '2008-01-01' AND '2008-12-31') > 0


Revision [156]

Edited on 2008-11-10 16:39:14 by SethKrieger
Additions:
DXCODE2 IN ('309.0','309.21','309.24','309.28','309.3','309.4') OR
DXCODE3 IN ('309.0','309.21','309.24','309.28','309.3','309.4') OR
DXCODE4 IN ('309.0','309.21','309.24','309.28','309.3','309.4') )
Deletions:
DXCODE2 IN ('309.0','309.21','309.24','309.28','309.3','309.4') OR
DXCODE3 IN ('309.0','309.21','309.24','309.28','309.3','309.4') OR
DXCODE4 IN ('309.0','309.21','309.24','309.28','309.3','309.4') )


Revision [155]

Edited on 2008-11-10 16:38:50 by SethKrieger
Additions:
AND
(DXCODE1 IN ('309.0','309.21','309.24','309.28','309.3','309.4') OR
DXCODE2 IN ('309.0','309.21','309.24','309.28','309.3','309.4') OR
DXCODE3 IN ('309.0','309.21','309.24','309.28','309.3','309.4') OR
DXCODE4 IN ('309.0','309.21','309.24','309.28','309.3','309.4') )
Deletions:
AND (DXCODE1 IN ('309.0','309.21','309.24','309.28','309.3','309.4') OR
DXCODE2 IN ('309.0','309.21','309.24','309.28','309.3','309.4') OR
DXCODE3 IN ('309.0','309.21','309.24','309.28','309.3','309.4') OR
DXCODE4 IN ('309.0','309.21','309.24','309.28','309.3','309.4') )


Revision [154]

Edited on 2008-11-10 16:38:00 by SethKrieger
Additions:
======Patients with any of Several Diagnoses Seen This Year======
I need a list of patients with certain diagnoses (309.0, 309.21, 309.24, 309.28, 309.3, or 309.4) who were seen for treatment this year.
SELECT
/*columns to include in list */
lastname,
firstname,
dob,
socsec
FROM
patients a JOIN ptcsudx b ON a.ptcsunum = b.ptcsunum
WHERE
/* at least one charge in ledger during the current year */
(SELECT count(*) FROM journal
WHERE trantype = 'S' AND amount > 0 AND trandate BETWEEN '2008-01-01' AND '2008-12-31') > 0
/* one of patient's dx's must be in the specified list of codes */
AND (DXCODE1 IN ('309.0','309.21','309.24','309.28','309.3','309.4') OR
DXCODE2 IN ('309.0','309.21','309.24','309.28','309.3','309.4') OR
DXCODE3 IN ('309.0','309.21','309.24','309.28','309.3','309.4') OR
DXCODE4 IN ('309.0','309.21','309.24','309.28','309.3','309.4') )
ORDER BY
lastname, firstname, dob
Deletions:
======Query Title ======
comments here appear in italics
paste your tested query here


Revision [153]

The oldest known version of this page was created on 2008-11-10 16:34:10 by SethKrieger [Cloned from NewQuery]
Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by WikkaWiki