Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sql problem 1

Status
Not open for further replies.

MattRK

Programmer
Feb 3, 2002
29
US
Ok, i made a simple query that just pulls up records where the field Customers.[Temp Stop]=1 (yes).

This is the exact query:
SELECT Customers.[Street Address]
FROM Customers
WHERE Customers.[Temp Stop]=1;

Yet, it pulls up no records. I konw i have about 5 to 10 records that have temp stop as yes. Is there something wrong with that sql? It looks good to me, but i may have done something wrong.

Thanks!
-Mr.K
 
The problem is that the value for "yes" is actually -1. You can avoid the whole problem of getting the right value if you modify your query as follows:
[tt]
SELECT Customers.[Street Address]
FROM Customers
WHERE Customers.[Temp Stop]
[/tt]
You don't have to compare the field [Temp Stop] to anything. The field itself acts as the criteria!

Incidentally, any of the following will also work:
[tt]
SELECT Customers.[Street Address]
FROM Customers
WHERE Customers.[Temp Stop]=True

SELECT Customers.[Street Address]
FROM Customers
WHERE Customers.[Temp Stop]=-1
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top