|
Home > Archive > Programming with dBASE > February 2006 > Help translating Microsoft Sequal server SQL to local dbase
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Help translating Microsoft Sequal server SQL to local dbase
|
|
| Greg Blevins 2006-02-28, 8:25 pm |
| Hello all,
I have a SQL statement that was run on Microsoft SQL. I was hoping someone could help me translate this to work on local SQL for dbase. It appears to me that the exists line is where trouble sets in. I referred to the SQL help manual but have not found
a solution.
Thanks in advance.
Greg Blevins
select count(distinct d.inc_key)
from diagnos d,
outcome o,
ed
where ed.inc_key = d.inc_key
and o.INC_KEY = ed.INC_KEY
and DCODE in ('785.59','998.0','958.4')
and YOADMIT > 1999
and o.charges <> -81
and exists
(select 'x' --distinct inc_key
from diagnos
where diagnos.inc_key = ed.inc_key
and DCODE not in
('022.3','098.89','054.5','027.0','036.2','020.2','003.1','004.3','003.1','079.99','790.7'))
| |
| Eric Logan 2006-02-28, 8:25 pm |
| Greg;
'Exists' is supposed to work in dBase SQL, but "(select 'x' --distinct
inc_key from diagnos" looks like incorrect syntax for dBase. Try
substituting: "(select distinct inc_key from diagnos"
E.L.
"Greg Blevins" wrote
> Hello all,
>
> I have a SQL statement that was run on Microsoft SQL. I was hoping
someone could help me translate this to work on local SQL for dbase. It
appears to me that the exists line is where trouble sets in. I referred to
the SQL help manual but have not found a solution.
>
> Thanks in advance.
> Greg Blevins
>
> select count(distinct d.inc_key)
> from diagnos d,
> outcome o,
> ed
> where ed.inc_key = d.inc_key
> and o.INC_KEY = ed.INC_KEY
> and DCODE in ('785.59','998.0','958.4')
> and YOADMIT > 1999
> and o.charges <> -81
> and exists
> (select 'x' --distinct inc_key
> from diagnos
> where diagnos.inc_key = ed.inc_key
> and DCODE not in
>
('022.3','098.89','054.5','027.0','036.2','020.2','003.1','004.3','003.1','0
79.99','790.7'))
>
|
|
|
|
|