473,395 Members | 2,798 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Query multiple fields

Hi

I have the following table in a database:

Name: Table 1

Field 1: Account ID
Field 2: FILM ID 1
Field 3: FILM ID 2
Field 4: FILM ID 3
Field 5: FILM ID 4
Field 6: FILM ID 5

I am not looking to change the table design at all. I am trying to create an SQL query that will search each of these fields for the same film ID, rather than having to type in each id five times to search each field individually. I also want to ensure that if I type in "ermina" it brings up "terminator" for example. This is what I have but it doesnt seem to work:

SELECT * FROM TABLE1 WHERE (Film 1 LIKE "*" & [SearchString] & "*") OR (Film 2 LIKE "*" & [SearchString] & "*") OR (Film 3 LIKE "*" & [SearchString] & "*") OR (Film 4 LIKE "*" & [SearchString] & "*") OR (Film 5 LIKE "*" & [SearchString] & "*"),
Feb 24 '07 #1
4 1651
willakawill
1,646 1GB
Hi

I have the following table in a database:

Name: Table 1

Field 1: Account ID
Field 2: FILM ID 1
Field 3: FILM ID 2
Field 4: FILM ID 3
Field 5: FILM ID 4
Field 6: FILM ID 5

I am not looking to change the table design at all. I am trying to create an SQL query that will search each of these fields for the same film ID, rather than having to type in each id five times to search each field individually. I also want to ensure that if I type in "ermina" it brings up "terminator" for example. This is what I have but it doesnt seem to work:

SELECT * FROM TABLE1 WHERE (Film 1 LIKE "*" & [SearchString] & "*") OR (Film 2 LIKE "*" & [SearchString] & "*") OR (Film 3 LIKE "*" & [SearchString] & "*") OR (Film 4 LIKE "*" & [SearchString] & "*") OR (Film 5 LIKE "*" & [SearchString] & "*"),
Hi. Could you just clarify something please.
Does table 1 have 6 fields?
Is the name of the first field Account ID?
Is the name of the second field Film 1? etc
What type of data is stored in the second field?
thanks
Feb 25 '07 #2
Hi

Yes the name of the first field is Account ID and the name of the second field is Film 1 etc. The fields Film 1 - 5 store the reference Id for a film taken out by a customer, this is in order to keep track of each film the customer takes out.

I am aware of other ways that I could restructure the tables in my database to make the storing of each film Id much easier. The purpose of posting this thread is to learn how to create a query that will search each of these fields for the same film ID, rather than having to type in each id five times to search each field individually.

thank you
Feb 25 '07 #3
willakawill
1,646 1GB
Nearly there. Just need you to tell me the type of data. I know that you call it the film ID That could be text and it could be numeric. Which one is it
Feb 25 '07 #4
Hi,

Thank you for helping me with this, the film Id is text
Feb 25 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Matthew Braumiller | last post by:
On Thu, 2 Oct 2003, "Gary Floam" <floam@comcast.net> wrote: >Sure you can do that. The easies way is to create a table of the last names >selected, and join that table into the query definition....
3
by: John young | last post by:
I have been looking for an answer to a problem and have found this group and hope you can assist . I have been re doing a data base I have made for a car club I am with and have been trying to...
4
by: Nicolae Fieraru | last post by:
Hi All, I have a Table1 with ID, Name, Address, Purchase. I want to build a query which shows all the records from Table1 (only fields ID, Name, Address), but there shouldn't be listed records...
1
by: Robert | last post by:
I am trying to create a db for service providers by county. I'm relatively new to db programming, but I have done quite a bit of programming ranging from the old basic days up to doing some...
0
by: Greg Strong | last post by:
Hello All, In the past I've used a combo box with the 'row source' being an Access SQL union query to select "All" or 1 for only 1 criteria in a query. An example is as follows: SELECT 0 As...
14
by: Darin | last post by:
I have a table that I want to delete specific records from based on data in other tables. I'm more familiar with Access '97, but am now using 2003, but the database is in 2000 format. In '97, I...
9
by: Jimbo | last post by:
Hello, I have a user request to build a form in an Access database where the user can check off specific fields to pull in a query. For example, let's say I have 10 fields in a table. The user...
3
by: mkjets | last post by:
I have worked for hours on trying to find a solution and have not figured it out. I am working in Access 2003. I need to create a query that takes values from 1 table and displays them in...
5
by: themastertaylor | last post by:
I've got a system to manage various quotes for building materials for a number of sites. i want a query to produce a report that shows me who HASN'T quoted for which sites. basically so i can...
1
by: tjm0713 | last post by:
Not sure this can be done but here is my current situation. I have a table containing millions of records. Each record has 28 fields. One of the fields I am trying to return the single record for...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.