Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Simple sql query not working /vfpoledb
Message
From
29/09/2006 15:31:34
 
General information
Forum:
Visual FoxPro
Category:
Visual FoxPro and .NET
Miscellaneous
Thread ID:
01158200
Message ID:
01158270
Views:
33
When you have:
SELECT DISTINCT Fld1, Fld2 .....
You get distinct records by ALL fields listed after DISTINCT clause.
But I am curious why first SELECT didn't works? This is a valid query in VFP:
CREATE CURSOR Test1 (Fld1 I, FLd2 M)
FOR asd = 1 TO 76
    INSERT INTO Test1 VALUES (asd%4+1, REPLICATE([a],asd))
NEXT
BROW
SELECT DISTINCT Fld1;
 FROM Test1 WHERE Fld2 LIKE 'a%'
>I tried it and it worked. Thanks. I guess old fashioned SQL is not enuf.
>
>>Try:
>>
>>SqlDataSource2.SelectCommand = "SELECT office, MAX(nsn) AS Nsn FROM csulog6 where nsn like" + "'51%' GROUP BY Office order by office"
>>
>>
>>
>>
>>
>>>SqlDataSource2.SelectCommand = "SELECT distinct office FROM csulog6 where nsn like" + "'51%' order by office" <-- GIVES the error
>>>
>>>SqlDataSource2.SelectCommand = "SELECT distinct office,nsn FROM csulog6 where nsn like" + "'51%' order by office" <--GIVES no error but I do not get get the OFFICE uniquely. :-(
>>>
>>>
>>>
>>>>
>>>>>No, that was a typo just when I wrote in the UT, error still exists.
>>>>>
>>>>>>You have wrong table name, 'thistable' instead of 'csulog6'.
>>>>>>
>>>>>>>In my VB asp page I have this line
>>>>>>>"SELECT distinct office FROM thistable where nsn like" + "'51%' order by office"
>>>>>>>
>>>>>>>and I get this error
>>>>>>>
>>>>>>>A field or property with the name 'nsn' was not found on the selected data source.
>>>>>>>However "SELECT distinct office,nsn FROM csulog6 where nsn like" + "'51%' order by office" does work
>>>>>>>
>>>>>>>PS, I am using VFPOLEDB to access a microsoft visual Foxpro table
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Reply
Map
View

Click here to load this message in the networking platform