Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Select statement returns incorrect results
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01456688
Message ID:
01456690
Views:
68
This message has been marked as the solution to the initial question of the thread.
Use AND, not OR (see correction inside)

In other words NOT (Field LIKE 'Value1' OR field LIKE 'Value2')

Is the same as

NOT Field like 'Value1' AND not field like 'Value2'


>I have a query that I am trying to run, but it is returning incorrect results.. My table has values as follows
>
>
>lname                     
>=====
>person1
>person2
>BADGE/332
>BADGE/331
>person3
>person4
>VACANT/333
>etc...
>
>
>
>when I run the following query:
>
>
>SELECT Employee.e_lname, Employee.e_fname, Employee.e_mi, Employee.e_dob,;
>  Employee.e_phq, Employee.e_unit, Employee.e_class, Employee.e_flg13,;
>  Employee.e_flg14, Employee.e_flg15, Employee.e_flg16,;
>  Employee.e_empstatus, Employee.e_id, Employee.e_flg2, Employee.e_pic;
> FROM ;
>     employee;
>  WHERE  Employee.e_lname NOT LIKE ( "%BADGE%" );
>  AND Employee.e_lname NOT LIKE ( "%VACANT%" )
>
>
>I still keep getting all the records that are like BADGE and VACANT. How do I exclude these?
>
>thanks
>nick
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform