Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating Queries

Status
Not open for further replies.

math20

MIS
Jul 7, 2005
71
CA
Happy New Year to All!

I have a table with fields as Department ID, Name, Item, January, February……December.

There are four different types of item. I have created queries to separate these items and have a table for each item with Dept ID, Name, January, February……December.

What I would like to do is be able to get a specific data for one person and for one month say November only, this should be based on a form where I have a drop down box to select the person and month I want the data for. I have the drop down box for the Name and the month, but I can create a query to extract a single data for one person in one month.
Please let me know if you need any further information.
Can anyone help me please?
 
Hi,

Your table is not normalized and should be redesigned before proceeding.

[tt]
Dept ID, Name, , Item, TheDate, TheValue
[/tt]





Skip,

[glasses] [red]Be Advised![/red] The Vinyards of Texas have produced a wine with diuretic dimishment and urethric relief...
Pinot More![tongue]
 
Thank you Skip. I will try and see if I can redo the table the problem is I am importing this table from another database and that is how the fields are layed out. I will see if I can run a SQL Query from that database.

Thanks again.
 


You can do 11 union queries
Code:
Select Dept ID, Name, Item, DateSerial(2006,1,1), Jan
From...

UNION

Select Dept ID, Name, Item, DateSerial(2006, 2,1), Feb
From...

UNION
...


Skip,

[glasses] [red]Be Advised![/red] The Vinyards of Texas have produced a wine with diuretic dimishment and urethric relief...
Pinot More![tongue]
 
If you are importing it, you can take the existing data and structure it the correct way during the import process.

Leslie

Anything worth doing is a lot more difficult than it's worth - Unknown Induhvidual

Essential reading for anyone working with databases: The Fundamentals of Relational Database Design
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top