Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sql command
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows 2000 SP4
Network:
Windows 2000 Pro
Database:
MS SQL Server
Miscellaneous
Thread ID:
01139315
Message ID:
01139696
Views:
10
This message has been marked as the solution to the initial question of the thread.
>i asked my friend for a few more details, i was in the process of leaving yesterday when he called and asked me. the data is actually numeric in field 1 and 2. all the data is in SQL server, i think that he is trying the code from access using odbc. if he had the below table he would want to return the rows 3 and 5. saying something like show field 2 <> 0 will not work as there could be older data in there so it has to search on field2 found anywhere in field1.
>
>FIELD1  NAME   STATUS FIELD2
>1       STU    LIVE   0
>2       MARK   LIVE   0
>3       STU    LIVE   1
>4       STEVE  LIVE   0
>5       MARK   LIVE   2
>
>thanks for all the help.
>~M
>
>>>hi all,
>>>i have a friend who is trying to do a sql command but is not having any luck. basically he wants to return field1 from table 1 where field2 occurs in field1. i am not great with sub querys but is this easy/possible to do? i suppose it would go something like in pyudocode
>>>
>>>select table1.field1 from table1 where table1.field2 is found anywhere in table1.field1
>>>
>>>~M
>>
>>Can you post some exaple data and desired result? Because the question is not clear (at least for me).
>>What value of Field2 must be in field1? ALL or just first or some other?
SELECT MyTable.* FROM MyTable
WHERE MyTable.Field2 IN (SELECT Field1 FROM MyTable)
(not tested)
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform