Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 Query A Partial String

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-04-29 : 07:38:54
Troy writes "I don't know if this really counts as SQL -- I'm using Access...

I have a field named TATEKS that contains multiple "objective numbers" (i.e.: 1c, 3d, 4b, etc.). I want the user to be able to enter a single objective number to retrieve the matching record or records.

The problem is that the objective numbers must be entered exactly as entered in the field (all objectives must be there, and in the same order). I want to be able to retrieve the record if the User Input matches only a portion of the data in that field (i.e.: only one of several possible objective numbers).

The statement I have been working with follows:

SELECT [Lessons].[TATEKS], [Lessons].[TEKS], [Lessons].[Subject], [Lessons].[Grade], [Lessons].[Topic], [Lessons].[Description], [Lessons].[Title], [Lessons].[Materials], [Lessons].[Resources], [Lessons].[Technology], [Lessons].[ElectronicResources], [Lessons].[ID]
FROM Lessons
WHERE ((([Lessons].[TATEKS]) Like [Enter TATEKS Number:]));"

mfemenel
Professor Frink

1421 Posts

Posted - 2005-04-29 : 09:06:35
I'm not 100% sure on what you're trying to do. Are you trying to retrieve any matches if the user enters 1 for example. You'd get 1a, 1b, 1c. Or are you trying to get an exact match back for example user enters 1c and your row contains 1c and 1C you'd want just the 1c row back?

Mike
"oh, that monkey is going to pay"
Go to Top of Page

AndrewMurphy
Master Smack Fu Yak Hacker

2916 Posts

Posted - 2005-04-29 : 09:07:07
post (more) sample input data...ie multiple rows
and also several examples of the search string
and the matching expected results.

your description is too vague
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2005-04-29 : 12:01:12
>>I have a field named TATEKS that contains multiple "objective numbers" (i.e.: 1c, 3d, 4b, etc.).

Whether you are using SQL or Access, normalization is still ALWAYS a good idea:

http://www.datamodel.org/NormalizationRules.html

From what you've said, it sounds like 1 column in your table has multiple values stored in it, and that is why things are so complicated. If you need to store multiple values in a column, you should take those values and store them in multiple ROWS in a related table.

- Jeff
Go to Top of Page
   

- Advertisement -