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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hello! I want to select a column

Status
Not open for further replies.

arneweise77

Programmer
Apr 25, 2002
46
SE
Hello!

I want to select a column named hours with the criteria &quot;date >= 'some date' AND date <= 'other date'&quot;. In this table a also have a column named workcenter. My problem is that for workcenter one and two a want the same date criterias but for workcenter three a want to use diffrent dates. I tried to do it with union but don´t quite remember how it works.

Thanks!!
 

You ar on the right track
to do what you want follow these steps

1 : create qry1 this is going to be the on for workcentres
1 & 2
in the date criteria put inserting actual dates
where start & end are

Between #start# & #end#

2: in the workcentre field put the criteria 1 And 2
Get this query running and save it

3: copy the above query and save as qry2

4: With qry2
change the workcentre criteria to 3
change the date criteria as required
5: create a new query and go into the SQL

6: copy the SQL from qry1 and put it in the new query

7: close qry1 down

8: copy the SQL from qry2 Beneath the SQL from qry1 type

Union and then copy the SQL from qry1 and put it in
the new query


this will give you your union query with the data you want.

NB the queries have to be identical except for criteria or it wont work that's why you do the copies

regards

jo








 
Thanks Jo!
But when i´m running query one i get 24 rows, running query two gives one row. Running query three with the union gives only 12 rows should be 25, shouldn´t it?

AW
 
Hio there
if the 12 rows you are getting are in a common date area to both work centres then I got the union query process being mis used here.
if that is the case let me know and I'll give you another work around
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top