Jumat, 21 Oktober 2011

RE: [MS_AccessPros] Strange result of query

 

Hi Lee

How was the data entered? Was it imported from somewhere? It is possible
there is something invisible at the start of each field.

Try this query:
SELECT EmployeeID, Asc(EmployeeID) as FirstChar FROM tblEmployee WHERE
EmployeeID LIKE '*009*'

In the FirstChar column you should see only 48, but I suspect there will be
another value - what is it?

Best wishes,
Graham

> From: MS_Access_Professionals@yahoogroups.com
[mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of Lee
> Sent: Saturday, 22 October 2011 12:34
> To: MS_Access_Professionals@yahoogroups.com
> Subject: [MS_AccessPros] Strange result of query
>
>  
> Hi,
> I have a text field for Employee ID that is all numeric about 85% of the
time. I wrote a query to give me all of the IDs that start with a specific
number sequence:
>
> SELECT * FROM tblEmployee WHERE EmployeeID LIKE '009*'
>
> and got no results. I KNOW there are employees that start like that
because everyone working in a certain business unit starts with that code.
>
> So I changed it to:
> SELECT * FROM tblEmployee WHERE EmployeeID LIKE '*009*'
>
> (notice I surrounded the string with *)
>
> And got the results I wanted. Every Employee ID has 009 as the left 3
characters if they are in a specific BU, so why didn't the first one return
any results? The field is formatted as text on the table. I trimmed the
field and tried the original again but to no avail.
>
> Thanks
> -Lee

__._,_.___
Recent Activity:
MARKETPLACE

Stay on top of your group activity without leaving the page you're on - Get the Yahoo! Toolbar now.

.

__,_._,___

Tidak ada komentar:

Posting Komentar