Robert Thank you very much for your interest and advise. Yes, I am encountering this problem with the error, if the cursor already exists (e.g. when I click on the next object for which to get the info). This is a problem I've tried to get across with "drop table" (but I can't drop it till I know it's not needed, and I only know that when the user clicks for another info - Catch-22). I've also tried creating the work table at the start of the app., with the extra columns, but then my initial selection fails cos I don't select the same no. of columns to match the work table, or, as the work table already exists, am told that the table is already open. And I don't see how to put in dummy cols in the sel., as can be done with "real-world" SQL :-)
Now, if you read my original message, from before this problem (see below), you'll see that the example from this problem is not the whole story; I've already tried this route of preference: I need to get 3 "foreign" description values from other related tables to create a full view - descriptions from the FK values. So the reason I'm going about it in this cack-handed fashion is that I can't do a 3-related-table join with this Substandard QL I overcame the 2-related-table join, mentioned in the example, but MB just wouldn't have a 3 - unless I hit upon it by sheer chance! Talk about "batted from pillar to post"! If you've any ideas on how to get around either the 4 table join, or this then I'd be most obliged. Best wishes Terry --- Original Message before this problem -------------- Dear List The Help on Select SQL is fairly scratchy but does state that it's based on GP SQL. It doesn't give any examples of accessing more than 2 tables. Now then, I have a table with foreign key references to at least two other tables. e.g. The Stops table bears a foreign ref, ZoneNo, to the zone in which it resides, and one to its county, and one referring to the Zone Group that comprises its catchment area. I'm creating a bespoke "info tool" whereby I can display all the info pertaining to the facility, but I want to get the full info from the referenced tables, e.g. select * from facmast, facdesc, buszoner where facmast.fac_code = FacDesc.fac_code and facmast.zone = buszoner.zonenumber Issuing the above select I get the error messgage: "Incorrect tables are joined. Invalid join condition in where clause." But this is just bog-standard SQL, which I've used extensively in other languages. I've tried different permutations, and "Select ... Where .... And ... In ( Select ....)" all to no avail. I've come to the conclusion that, despite how the Help command syntax suggests, you can't select from more than 2 tables except maybe when you're selecting from the other tables on the same key. Any advise? -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: 16 November 2005 21:46 To: Terry McDonnell Subject: Re: [Mapinfo-l] Mapinfo playing hard-to-get with me Terry, not sure about why you need to add new columns to csrFacMastPlus if this is temporary table - and if not, then you will run the risk of getting an error because the fields are present. But on your question: Perhaps you could do the lot with a selection first. Select * from FacMast, FacDesc Where FacMast.RowID = lnRowID AND FacMast.Fac_Code = FacDesc.Fac_Code into SEL_TEMP If SelectionInfo( SEL_INFO_NROWS) > 0 then Insert into csrFacMastPlus Select * from Selection 'or the columns you want. End If Or if there is a possibility that you won't have a description in FacDesc for every Fac_Code, or you want to use more than one look-up, you could use an update column. Select * from FacMast Where FacMast.RowID = lnRowID Into SEL_TEMP If SelectionInfo( SEL_INFO_NROWS) > 0 then Add Column "SEL_TEMP" (FT_Desc Char (35)) From FacDesc Set To Desc Where Fac_Code = FacCode Dynamic more updates of other fields. Then insert your record from SEL_TEMP into csrFacMastPlus You can experient with the update table command with your mapbasic window open to get the syntax right. r > Hi Listers > > Consider the following code: > _____________________________ > Select * from FacMast > Where RowID = lnRowID > Insert into csrFacMastPlus > Select * from Selection > Commit Table csrFacMastPlus > Alter Table csrFacMastPlus ( Add Zone_Desc Char( 40), > FT_Desc Char( 35), > ZG_Desc Char( 50)) > Commit Table csrFacMastPlus > > If SelectionInfo( SEL_INFO_NROWS) > 0 then ' then found the correct > row > lnFacCode = FacMast.Fac_Code > lnZone = FacMast.Zone > lcCatchZG = FacMast.CatchZG > Select Desc from FacDesc > where FacDesc.Fac_Code = lnFacCode > into csr1 NoSelect > If SelectionInfo( SEL_INFO_NROWS) > 0 then > browse * from csr1 > Update csrFacMastPlus > Set FT_Desc = csr1.Desc > <--------------------------!!!!!!!!!!!!!!! > End If > ... > End If > _________________________________ > > When it gets to the line marked with the arrow I get the error > "variable or field csr1.Desc not defined" > This is despite the fact that: > 1) It wouldn't get to that line if the SelectionInfo() failed > 2) The Browse shows a column "Desc", and the browse window heading is > "crs1" > > I've tried it with Selection.csr1 - same error only "Selection.Desc" > I suspected I didn't need the second commit statement, so it had been > ommitted but the error message them prompted me to put it in. > > This is all part of my daily "firefighting" with this language, rather > than progressing, and I've run out of permutations/ideas. > Can anybody tell me what the problem is? > > 'ppreciate it > > Terry McDonnell > > _______________________________________________ > Mapinfo-l mailing list > [email protected] > http://www.directionsmag.com/mailman/listinfo/mapinfo-l > _______________________________________________ MapInfo-L mailing list [email protected] http://www.directionsmag.com/mailman/listinfo/mapinfo-l
