Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

How can I releate a cursor with a table?

2 posts in FoxPro Last posting was on 2007-02-05 20:06:31.0Z
Hugo Glez Posted on 2007-02-05 18:12:36.0Z
From: "Hugo Glez" <gomh7172@prodigy.net.mx>
Newsgroups: Advantage.FoxPro
Subject: How can I releate a cursor with a table?
Date: Mon, 5 Feb 2007 12:12:36 -0600
Lines: 38
Organization: 3GM
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3028
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028
NNTP-Posting-Host: 189.165.16.228
Message-ID: <45c77286@solutions.advantagedatabase.com>
X-Trace: 5 Feb 2007 11:08:06 -0700, 189.165.16.228
Path: solutions.advantagedatabase.com!solutions.advantagedatabase.com!189.165.16.228
Xref: solutions.advantagedatabase.com Advantage.FoxPro:228
Article PK: 1109582

I have this query's in VFP 8.0

text to lcComando noshow textmerge pretext 7
select pa.p_id, mu.analisis, mu.status, mu.no_result, pa.contrasena,
pa.expediente,
mu.registro, mu.tipo_estud, pa.sucursal,
pa.p_nombre, pa.p_credenci, pa.urgencia, pa.p_sndx, pa.p_descuent,
pa.p_factura, pa.p_costo, pa.p_anticipo, pa.p_compleme, pa.p_credito,
pa.compromiso,
pa.p_empresas, pa.fur, pa.obs_clinic
from paciente pa, muestras mu
where mu.fch_hr_vob >= '20061016'and mu.fch_hr_vob <= '20070205'
and pa.p_id = mu.id
and position('GARCIA' in upper(pa.p_nombre)) > 0
and not (pa.urgencia='')
and pa.p_doctor='ALCAAL '
and pa.sucursal not in('GOL','CC ')
order by pa.p_id
endtext

lnres = sqlexec(ghandle,lcComando,'q_pac')

But now I need to have a query about this one:

text to lcComando noshow textmerge pretext 7
select qp.*, re.r_comp, re.r_result_c, re.r_result_n
from q_pac qp, resultad re
where qp.p_id + qp.analisis = re.r_id + re.r_analisis
endtext

lnres = sqlexec(ghandle,lcComando,'q_res')

My question is how can I relate one cursor(q_pac) with one table(resultad),

because I'm going to need the cursor(q_pac) for to do more select,
the table paciente y muestras are too big, about 500,000 records


Mark Wilkins Posted on 2007-02-05 20:06:31.0Z
From: "Mark Wilkins" <mark@no.email>
Newsgroups: Advantage.FoxPro
References: <45c77286@solutions.advantagedatabase.com>
Subject: Re: How can I releate a cursor with a table?
Date: Mon, 5 Feb 2007 13:06:31 -0700
Lines: 31
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3028
X-RFC2646: Format=Flowed; Response
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028
NNTP-Posting-Host: 10.24.38.228
Message-ID: <45c78d40@solutions.advantagedatabase.com>
X-Trace: 5 Feb 2007 13:02:08 -0700, 10.24.38.228
Path: solutions.advantagedatabase.com!solutions.advantagedatabase.com!10.24.38.228
Xref: solutions.advantagedatabase.com Advantage.FoxPro:229
Article PK: 1109583

Hi Hugo,

I think temporary tables will help solve this this. Put the results of the
first query into a temp table and then use it in the second query.

http://devzone.advantagedatabase.com/dz/webhelp/Advantage8.1/extprocs/temporary_tables.htm

Mark Wilkins
Advantage R&D

"Hugo Glez" <gomh7172@prodigy.net.mx> wrote in message
news:45c77286@solutions.advantagedatabase.com...
>I have this query's in VFP 8.0
>
> text to lcComando noshow textmerge pretext 7
> select pa.p_id, mu.analisis, mu.status, mu.no_result, pa.contrasena,

<snip>

> endtext
>
> lnres = sqlexec(ghandle,lcComando,'q_pac')
>
> But now I need to have a query about this one:
>
> text to lcComando noshow textmerge pretext 7
> select qp.*, re.r_comp, re.r_result_c, re.r_result_n
> from q_pac qp, resultad re
...