Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL duplicates Question
Message
From
23/09/2012 04:48:37
 
 
To
22/09/2012 16:59:29
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01553489
Message ID:
01553495
Views:
55
>>
*USE (m.TableToSave) && Not necessary, the SQL statement opens the table automatically
>>SELECT field1, field2 FROM (m.TableToSave) GROUP BY field1, field2 having count(*)>1 INTO cursor sqltemp && You must list every field!!
>>SET SAFETY OFF
>>*CLOSE TABLES ALL && Not necessary
>>Select * from sqltemp into table (m.tableToSave)
>>CLOSE TABLES ALL
>>
>>>The SQL below crashes on the 'GROUP BY' line but still runs through to a BROWSE statement below the SQL.
>>>Duplicates are not removed in the result. When I close the BROWSE window, the GROUP BY line is highlighted.
>>>
>>>* Remove dupicates
>>>USE (m.TableToSave)
>>>SELECT * FROM (m.TableToSave)
>>>GROUP BY hits
>>>INTO TABLE sqltemp
>>>SET SAFETY OFF
>>>CLOSE TABLES ALL
>>>COPY FILE sqltemp.DBF TO (m.TableToSave)
>>>CLOSE TABLES ALL
>>>
>>>What have I missed?
>
>I didn't know the list all fields rule. Takk.

You're welcome.
Previous
Reply
Map
View

Click here to load this message in the networking platform