Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Another SQL Server 2000 Query Conundrum
Message
From
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:
01245356
Views:
49
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...



>>Any idea why this query would work fine on one server but return the error:
>>
>>Ambiguous column name 'vehi_id' on another? One server is SQLServer 2000 and the other is SQLServer 2005, but the query should work on both versions...
>>
>>Why in SQLServer2005 know which column I'm trying to retrieve but in SQLServer2000 it appears that it doesn't know which column I'm trying to retrieve. I'm know I'm joining on more than one table but I'm not sure how to do the same thing another way and achieve the same results for SQLServer2000.
>
>Are you using the second variation? If yes, then instead of * you may want to specify alll the fields you want to select.
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform