Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Another SQL Server 2000 Query Conundrum
Message
 
 
To
01/08/2007 22:03:16
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01243142
Message ID:
01245357
Views:
40
This message has been marked as a message which has helped to the initial question of the thread.
>Thanks Naomi, I'll give that a try. It will take a while to do since there are a LOT of fields in this table that I need to pull...
>
>Here is my query:
>
> TEXT TO lcSQL NOSHOW PRETEXT 15 TEXTMERGE
>     SELECT tw.* FROM table2 AS tw
>      INNER JOIN
>      (SELECT table1.inci_id FROM table1
>      WHERE  table1.inci_id = '<<thisform.pcInci_Id>>'
>      or table1.inci_id = '<<thisform.pcParent_Id>>'
>      or table1.parent_id = '<<thisform.pcInci_Id>>'
>      or (LEN(table1.parent_id)>0 AND table1.parent_id = '<<thisform.pcParent_Id>>')) qry1
>      ON tw.inci_id = qry1.inci_id WHERE tw.table2id > 0 AND tw.vehi_id > 0 AND canccode='    '
>ENDTEXT
>
>IF SQLEXEC(lnConnection,m.lcSQL) > 0
>   TEXT TO lcSQL2 NOSHOW PRETEXT 15 TEXTMERGE
>        SELECT qry2.table2id, vh.* from table3 as vh
>        INNER JOIN (<<m.lcSQL>>) qry2
>        ON vh.vehi_id = qry2.vehi_id ORDER BY vehi_id
>   ENDTEXT
>
>   IF SQLEXEC(lnConnection,m.lcSQL2) > 0
>
>
>and it works great in SQL2005, but SQL2000 returns the error...
>

Tracy,

You have some strange where condition
>      WHERE  table1.inci_id = '<<thisform.pcInci_Id>>'
>      or table1.inci_id = '<<thisform.pcParent_Id>>'
>      or table1.parent_id = '<<thisform.pcInci_Id>>'
>      or (LEN(table1.parent_id)>0 AND table1.parent_id
and also you probably don't need to add prefix table1.

BTW, why do you need to run the first query? Just to test? And also your order by in the second query doesn't specify the table name. Looks like this is a problem.
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform