On Jun 26, 11:56=A0am, F.Qutai...@[EMAIL PROTECTED]
wrote:
> I have three derived tables generated by select some columns from the
> same tabel . I have written SQL statements to summarize the
> information of each table based on certain columns in the main table.I
> wrote =A0an SQL statement where in it sql should perform the
> summarization of each of the three derived tables separately and then
> the summarized results be joined together using where clause.
> My query is as follows:
>
> SELECT tb1.gs7usr as User, tb1.ADD, tb2.UPD, tb3.DEL from
>
> (SELECT B.gs7usr,COUNT(B.GS7nin)as ADD FROM RGS8 B where
> B.GS7act=3D'ADD'and B.gs7dte=3D20080310 and B.GS7tme=3D(select
Max(E.GS7t=
me)
> AS tme from RGS8 E where e.gs7nin=3Db.gs7nin) GROUP BY B.GS7USR) as tb1
>
> FULL JOIN (SELECT A.gs7usr,COUNT(A.GS7nin)as UPD FROM RGS8 a where
> A.GS7act=3D'UPD'and A.gs7dte=3D20080310 and A.GS7tme=3D(select
Max(D.GS7t=
me)
> AS tme from RGS8 D where D.gs7nin=3DA.gs7nin) GROUP BY a.GS7USR)as tb2
> ON tb1.GS7usr =3D tb2.gs7usr
>
> FULL JOIN (SELECT c.gs7usr,COUNT(c.GS7nin)as DEL FROM RGS8 c where
> c.GS7act=3D'DEL' and c.gs7dte=3D20080310 and c.GS7tme=3D(select
> Max(f.GS7tme) AS tme from RGS8 f where c.gs7nin=3Df.gs7nin) GROUP BY
> c.GS7USR) as tb3 ON tb1.gs7usr=3Dtb3.gs7usr order by tb1.gs7usr
>
> But VFP V9 =A0keep on displaying =A0the same erroreach time I try to
> execute the query and that is "Command contains unrecognized phrase/
> keyword " It worth mentioning that each query executes sucessflly when
> it is written in a separate query even if I tired the query with
> joining 2 tables only I still get the same error.
Sorry I'm replying to my message because I don't how to edit the
original post any way...I figured out the problem
If the SQL statement you want to pass is quite long, it might exceed
the maximum length of a string literal in Visual FoxPro, which is 255
characters. Longer strings will cause a "Command contains unrecognized
phrase/keyword" error. Solution you can pass long SQL statements if
you break them up into several concatenated literals.
Well I did that and got rid of that Error and ended up with another
error the sqlexec() returns -1 wich indicates an error in the
connection or the sql query Any help ? I need to know how to fix this
problem ASAP. Please help


|