Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL syntax
Message
From
26/06/2018 16:39:19
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 10
Miscellaneous
Thread ID:
01660886
Message ID:
01660886
Views:
64
Hi,

I am again struggling with a SQL statement, with my code I get error "Queries of this type are not supported" -
Anybody to help me with the correct syntax? I suppose the two times where are a problem. However I can't find a correct solution to get to the by me desired result.
CREATE CURSOR curNames (ID i, firstname c(10), lastname c(10))
INSERT INTO curNames values ( 1, "Koen", "Piller")
INSERT INTO curNames VALUES ( 2, "John", "Brown")
INSERT INTO curNames VALUES ( 3, "Karl", "Johnson")
INSERT INTO curNames VALUES ( 4, "Donald", "Sutterland")
INSERT INTO curNames VALUES ( 5, "Bill", "Gates")

CREATE CURSOR curGroupmember (ID i, iName i, iGroup i)
INSERT INTO curGroupmember VALUES (1, 2,1)
INSERT INTO curGroupmember VALUES (2, 3,1)
INSERT INTO curGroupmember VALUES (3, 2,2)
INSERT INTO curGroupmember VALUES (4, 1,2)

CREATE CURSOR curGroup (ID i, Name c(10)
INSERT INTO curGroup VALUES (1, "Groupa")
INSERT INTO curGroup VALUES (2, "Groupb")

- not working SQL statement: 

TEXT TO m.lcSql pretext 1+2+4+8
SELECT T1.firstname, T1.Id 
FROM curnames T1
where UPPER(T1.Firstname) like  ? m.lcLetter + '%'
and 
curnames.id in 
(SELECT distinct(curNAMES.Id ) FROM curNAMES 
INNER JOIN curGROUPMEMBER T3 ON T3.iName = T1.ID 
INNER JOIN curGROUP T4 on T4.Id = T3.iGroup where T4.Id = ? m.liGroup ) 
INTO CURSOR junk READWRITE NOFILTER
	ENDTEXT
&lcSql

lcLetter = "K"
liGroup = 2

TEXT TO lcSQL PRETEXT 1+2+4+8
I would like to have:

fullname	ID
Karl		3
Koen		1
ENDTEXT
Regards,

Koen
Next
Reply
Map
View

Click here to load this message in the networking platform