Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Queries / May 2006

Tip: Looking for answers? Try searching our database.

UNION query Challenges

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Cydney - 26 May 2006 21:07 GMT
I have this union query (below) that joins two tables. However, when I create
a new query with the union query as it's source, I do a sum on the [Bill
Amount] with a Group By on [Vendor], expecting to get a total on bill amount
with 1 vendor and all the rest should roll up to a second record because
vendor is otherwise blank. However I end up getting an extra record (total of
3).

Based on this union query structure can you give me some ideas of why that
would be?

SELECT Code, ProjNo,  F3, Invoice, TT, LLT, MidTask, TASK_NAME, [Empl],
[PER_DIEM_CODE] as [Per Diem Code], Classification, [Class Grade], [Title],
[Job Title Override], Hours, [Bill Rate],[Raw Cost], 0 as Quantity,  [Bill
Amount], ExpDate, "" as  [ExpCat], [ExpType], "" as Vendor,  "" as VIN, Thru
FROM [Labor-Current]

UNION ALL SELECT Code,ProjNo, F3,Invoice,TT, LLT, MidTask, "" as TASK_NAME,
[Empl],"" as [Per Diem Code], "" as Classification,"" as [Class Grade], "" as
[Title], "" as [Job Title Override], null as  Hours, [Bill Rate], null as
[Raw Cost], Quantity, [Bill Amount],ExpDate,[ExpCat],[ExpType], Vendor, VIN,
Thru
FROM [Expense-Current];
Signature

THX cs

KARL DEWEY - 26 May 2006 21:29 GMT
What is displayed in the third vendor field?  Nothing?
You may have vendor, nulls, and zero lenght entry in the record which is not
the same as null.  You can make all null zero lenght or all zero lenght to be
nulls.  An update query with this Is Null as criteria to update to "" for
zero lenght.  Or "" for criteria to update to Null.

> I have this union query (below) that joins two tables. However, when I create
> a new query with the union query as it's source, I do a sum on the [Bill
[quoted text clipped - 18 lines]
> Thru
> FROM [Expense-Current];
Cydney - 30 May 2006 16:43 GMT
I understand what you're saying. However, after using an update query and
making the records comply with either "" or Null as their value, the Vendor
column is still separating them. I'm still not sure why it is. There is not a
space in the records either. Note: these records are imported from Excel
which is exported directly from an Oracle SQL server.
Signature

THX cs

> What is displayed in the third vendor field?  Nothing?
> You may have vendor, nulls, and zero lenght entry in the record which is not
[quoted text clipped - 24 lines]
> > Thru
> > FROM [Expense-Current];
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.