Home > Archive > FoxPro Help and Support > April 2006 > Not a character expression (Error 45)









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 Not a character expression (Error 45)
Brhhk

2006-03-31, 3:32 am

Thanks for help.

I create a query in visual foxpro 9!The sql is:
select a.num,b.doctor;
from (select count(id) as num,cl group by cl) a;
(select count(id) as doctor,cl where dt="doctor" group by cl);
where a.cl=b.cl

It can get the correct data from the table,but it could not be readable by
the query designer.

Whenevery i quit/open the query view there is a messagebox say "Not a
character expression (Error 45)" and there is nothing in query designer.

I wander how to edit/run the sql without the warning.
Or without the designer tool edit the sql in the sql view directly!

Thanks anyway!
Jay B

2006-03-31, 3:32 am

i didn't think the query view could handle something that complex.
i always edit all queries by hand in the editor.
just say
modif command query.qpr
qhere query is the name of your query

Brhhk wrote:

> Thanks for help.
>
> I create a query in visual foxpro 9!The sql is:
> select a.num,b.doctor;
> from (select count(id) as num,cl group by cl) a;
> (select count(id) as doctor,cl where dt="doctor" group by cl);
> where a.cl=b.cl
>
> It can get the correct data from the table,but it could not be readable by
> the query designer.
>
> Whenevery i quit/open the query view there is a messagebox say "Not a
> character expression (Error 45)" and there is nothing in query designer.
>
> I wander how to edit/run the sql without the warning.
> Or without the designer tool edit the sql in the sql view directly!
>
> Thanks anyway!

Brhhk

2006-03-31, 3:32 am

Thanks for replay.
But how can i do the work followed sql.
select a.num,b.doctor;
from (select count(id) as num,cl group by cl) a;
(select count(id) as doctor,cl where dt="doctor" group by cl);
where a.cl=b.cl

What will i do is more complex than that one,and aslo didn't finish it by
query designer.

What should i do!

thanks for help
Jay B

2006-03-31, 3:32 am

you can start a new query in the designer and put all the other commands
in. but i know you want to add a little each time and test it to see
your progress, but i dont know what to tell you.
foxpro was never able to even do these complicated queries untill most
recently, so most of us have learned to work around this limitation.
i'm so used to writing sql code that i do it all by hand now.

you can also use the query designer to make each query separate, and
test, and then join them together in an editor.

you can also rework your cquery and do them separately,
for example:
select count(id) as num,cl group by cl ;
into cursor a
select count(id) as doctor,cl where dt="doctor" group by cl ;
into cursor b
select a.num,b.doctor;
from a join b ;
where a.cl=b.cl

this is always better and clearer to see what's going on, and easier for
the beginners to get right!


Brhhk wrote:

> Thanks for replay.
> But how can i do the work followed sql.
> select a.num,b.doctor;
> from (select count(id) as num,cl group by cl) a;
> (select count(id) as doctor,cl where dt="doctor" group by cl);
> where a.cl=b.cl
>
> What will i do is more complex than that one,and aslo didn't finish it by
> query designer.
>
> What should i do!
>
> thanks for help

AA

2006-04-03, 1:33 pm

You have to have a FROM clause in the subqueries :

SELECT A.num,B.doctor FROM (SELECT ... FROM Table ) A ,
(SELECT .. FROM Table ) B ;
WHERE A.cl=B.cl
or
SELECT A.num,B.doctor FROM (SELECT ... FROM Table ) AS A ;
JOIN (SELECT .. FROM Table ) AS B ;
ON A.cl=B.cl

-Anders

"Brhhk" <brhhk@163.com> skrev i meddelandet
news:Xns97977ABD95EA
5brhhk@207.46.248.16...
> Thanks for help.
>
> I create a query in visual foxpro 9!The sql is:
> select a.num,b.doctor;
> from (select count(id) as num,cl group by cl) a;
> (select count(id) as doctor,cl where dt="doctor" group by cl);
> where a.cl=b.cl
>
> It can get the correct data from the table,but it could not be readable by
> the query designer.
>
> Whenevery i quit/open the query view there is a messagebox say "Not a
> character expression (Error 45)" and there is nothing in query designer.
>
> I wander how to edit/run the sql without the warning.
> Or without the designer tool edit the sql in the sql view directly!
>
> Thanks anyway!



Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com