|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi all
I have a database that lists stock and each stock type has a unique InternalID like the following: D DM M MS MP N KA KP HD PR S CD G The codes were set for the stock before the database was built so they cant be changed. I have a count query that is based on the results of a query that searches for a specific stock type and weather or not its been sold, the problem I’m having is that when I query the db for all stock with the internal ID of D I get the DM stock in the query also. I’ve been using: SELECT [tbl_stock/equipment].EquipID, [tbl_stock/equipment].InternalID, [tbl_stock/equipment].Sold FROM [tbl_stock/equipment] WHERE ((([tbl_stock/equipment].InternalID) Like "D***") AND (([tbl_stock/equipment].Sold)=0)); How can I just get the D code and not the DM code in the query results (See 5qur_unsold_bases)? Thanks Mike Sample DB Attached |
|
#2
|
|||
|
|||
|
It's easy use = "D" or
Like "D?" for an additoonal one character. I will check your database and get back to you in about 2 hours. The time now is it's 5pm EST |
|
#3
|
|||
|
|||
|
Here is your solution:
SELECT [tbl_stock/equipment].EquipID, [tbl_stock/equipment].InternalID, [tbl_stock/equipment].Sold FROM [tbl_stock/equipment] WHERE ((([tbl_stock/equipment].InternalID) Like "D?") AND (([tbl_stock/equipment].Sold)=0)); However, I didn't find a stock ID With a single character liek "D" The Like operator can be manipulated with "D??" which would list you "M" codes. I hope this helps. |
![]() |
| Viewing: Dev Articles Community Forums > Databases > Microsoft Access Development > Like queries |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|