Advertisement

04.16.2008 at 11:01AM PDT, ID: 23328200
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.7

Take a SQL statement GROUP BY query and turn it into crosstab query - via Access 2003

Asked by stephenlecomptejr in SQL Query Syntax, Access Coding/Macros

I've got the following group by query that basically takes equipment items per department and summarizes them.  Now I've got to convert it to give me the top 10 most expensive equipment items.  How may I rearrange the SQL statement to do so -

Here's the SQL:

SELECT DISTINCTROW qTotals.Dept_TOC, qTotals.AltSortOrder, qTotals.Alternate, qTotals.TypeSortID, qTotals.Equip, qTotals.Type, qTotals.Name, qTotals.Furnish, qTotals.Install, Sum(qTotals.Ex_Quantity) AS SumOfEX_QUANTITY, Sum(qTotals.newqty) AS SumOfnewqty, Sum(qTotals.totqty) AS SumOftotqty, qTotals.Unitcost, Sum(qTotals.TotCOST) AS SumOfTotCOST, qTotals.TypeName, qTotals.Manuf, qTotals.Model_no, qTotals.Alt_Code, qTotals.Dept_Name, qTotals.[Spec Reviewed], qTotals.ASE, qTotals.UNM
FROM qTotals
GROUP BY qTotals.Dept_TOC, qTotals.AltSortOrder, qTotals.Alternate, qTotals.TypeSortID, qTotals.Equip, qTotals.Type, qTotals.Name, qTotals.Furnish, qTotals.Install, qTotals.Unitcost, qTotals.TypeName, qTotals.Manuf, qTotals.Model_no, qTotals.Alt_Code, qTotals.Dept_Name, qTotals.[Spec Reviewed], qTotals.ASE, qTotals.UNM;

It's of course connected to qTotals - so please let me show you that one as well -

SELECT DISTINCTROW PROJ_INF.[Project Information], ALTSORT.AltSortOrder, PROJ_DPT.Dept_TOC, PROJ_DPT.Dept_Code, PROJ_RM.Room_Number, PROJ_EQ.Equip, PROJ_ME.Type, PROJ_ME.ASE, PROJ_RM.Rm_Quantity, [Rm_Quantity]*[quantity] AS totqty, PROJ_EQ.Alternate, PROJ_RM.BldgID, PROJ_DPT.Dept_Name, PROJ_RM.Room_Name, PROJ_EQ.Quantity, PROJ_EQ.Ex_Quantity, [totqty]-[EX_QUANTITY] AS newqty, [newqty]*[Unitcost] AS TotCOST, [newqty]*PROJ_ME.ListPrice AS TotCOST1, [newqty]*[ReqQuotePrice] AS TotQUOTE, PROJ_ME.Name, tblequiptype.TypeName, PROJ_ME.Furnish, PROJ_ME.Install, Actual_Cost(nz(PROJ_ME.ListPrice,0),PROJ_ME.ReqQuotePrice,nz(PROJ_ME.discount,1),PROJ_EQ.Alternate) AS Unitcost, tblequiptype.TypeSortID, MEDEQ.Manuf, MEDEQ.Model_no, MEDEQ.ListPrice, PROJ_ME.EManuf, PROJ_ME.EModel_no, PROJ_ME.Alt_Code, PROJ_ME.BidPack, PROJ_INF.[Project Name], PROJ_INF.[Project Number], PROJ_INF.[Project Phase], PROJ_ME.Item, PROJ_EQ.[Qty Checked], PROJ_EQ.[Spec Reviewed], PROJ_ME.InstallBy, PROJ_ME.InstallRemarks, PROJ_ME.LeadTimes, PROJ_ME.EstDueDate, PROJ_ME.SplitShipComments, PROJ_ME.[Vendor Delivery], PROJ_ME.[Payment Terms], PROJ_ME.MEPcriteria, PROJ_RM.Sheet_No, PROJ_ME.ReqQuotePrice, PROJ_EQ.Remarks, tblequiptype.Show, PROJ_DPT.Show, PROJ_RM.Show, PROJ_ME.Show, ALTSORT.Show, PROJ_INF.Show, PROJ_ME.UNM, PROJ_INF.[Client Name], PROJ_ME.Requisition, IIf(PROJ_ME!Requisition Is Null,False,True) AS Req, PROJ_ME.discount, PROJ_RM.Floor, PROJ_ME.Electrical, PROJ_ME.Mechanical, PROJ_ME.Plumbing, PROJ_ME.Emer_power, PROJ_ME.Seismic
FROM (PROJ_INF INNER JOIN (PROJ_DPT INNER JOIN PROJ_RM ON PROJ_DPT.Dept_Code=PROJ_RM.Dept_Code) ON PROJ_INF.[Project Information]=PROJ_DPT.Proj_infid) INNER JOIN (ALTSORT INNER JOIN (tblequiptype INNER JOIN ((MEDEQ RIGHT JOIN PROJ_ME ON MEDEQ.ProductID=PROJ_ME.Alt_Code) INNER JOIN PROJ_EQ ON PROJ_ME.Code=PROJ_EQ.Equip) ON tblequiptype.Type=PROJ_ME.Type) ON ALTSORT.Alternate=PROJ_EQ.Alternate) ON PROJ_RM.Room_Number=PROJ_EQ.Room_Number
WHERE (((PROJ_INF.[Project Information]) Like fProjectID()) AND ((PROJ_DPT.Dept_Code) Like fDeptID()) AND ((PROJ_RM.Room_Number) Like fRoomNumID()) AND ((PROJ_EQ.Equip) Like fEquipCode()) AND ((PROJ_ME.Type) Like fEquipType()) AND ((PROJ_ME.ASE) Like fASEItems()) AND ((PROJ_RM.Rm_Quantity)>0) AND (([Rm_Quantity]*[quantity])>0) AND ((PROJ_EQ.Alternate) Like fAltID()) AND ((tblequiptype.Show) Like fShowType()) AND ((PROJ_DPT.Show) Like fShowDept()) AND ((PROJ_RM.Show) Like fShowRoom()) AND ((PROJ_ME.Show) Like fShowEquip()) AND ((ALTSORT.Show) Like fShowAlt()) AND ((PROJ_INF.Show) Like fShowInf()))
ORDER BY PROJ_INF.[Project Information], ALTSORT.AltSortOrder, PROJ_DPT.Dept_TOC, PROJ_RM.Room_Number, PROJ_EQ.Equip;

I would like to know not only the answer but the logic to help create another one the next time.  Thank you very much in advance for this.Start Free Trial
 
 
[+][-]04.16.2008 at 11:08AM PDT, ID: 21370450

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.16.2008 at 11:12AM PDT, ID: 21370479

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.16.2008 at 11:39AM PDT, ID: 21370705

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.16.2008 at 12:07PM PDT, ID: 21370981

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: SQL Query Syntax, Access Coding/Macros
Sign Up Now!
Solution Provided By: Delani
Participating Experts: 1
Solution Grade: A
 
 
[+][-]04.16.2008 at 01:35PM PDT, ID: 21371725

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.16.2008 at 02:49PM PDT, ID: 21372320

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.16.2008 at 03:04PM PDT, ID: 21372427

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.16.2008 at 04:24PM PDT, ID: 21372861

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.18.2008 at 04:15AM PDT, ID: 21384761

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.18.2008 at 05:23AM PDT, ID: 21385110

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20081112-EE-VQP-42 / EE_QW_2_20070628