I am currently building an Access database for booking and invoicing at the small business where I work. One of...
the tables I have built contains an employee name and then a number of columns which range from Popup_Date_1 to Popup_Date_12, which each hold a date value.
I would like to query all 12 fields at one time to look for one date and then pull that record if the date is contained in one of the twelve fields, but I am not able to get Microsoft Access to do this.
Is there an SQL query I could use to accomplish this? I'm sorry to be a bit more ignorant than most people on this site. This is the last obstacle to getting the whole thing working so I would love any advice you could offer!
First of all, here is the query that you need:
select employee_name , Popup_Date_1 , Popup_Date_2 , Popup_Date_3 , Popup_Date_4 , Popup_Date_5 , Popup_Date_6 , Popup_Date_7 , Popup_Date_8 , Popup_Date_9 , Popup_Date_10 , Popup_Date_11 , Popup_Date_12 from bookings where Popup_Date_1 = [enter search date] or Popup_Date_2 = [enter search date] or Popup_Date_3 = [enter search date] or Popup_Date_4 = [enter search date] or Popup_Date_5 = [enter search date] or Popup_Date_6 = [enter search date] or Popup_Date_7 = [enter search date] or Popup_Date_8 = [enter search date] or Popup_Date_9 = [enter search date] or Popup_Date_10 = [enter search date] or Popup_Date_11 = [enter search date] or Popup_Date_12 = [enter search date]
But more importantly—and thank you for asking for advice—your table should probably be normalized. Do a web search for the terms "database normalization" and "first normal form." You will find many useful articles.
Dig Deeper on Oracle and SQL
Related Q&A from Rudy Limeback
Read an example of an SQL case expression from our SQL expert Rudy Limeback. Continue Reading
Read SQL expert Rudy Limeback's advice for counting combinations in a table with SQL's GROUP BY clause Continue Reading
Read about the Mimer Validator, a tool used to verify your SQL code, in this tip from SQL expert Rudy Limeback. Continue Reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.