473,387 Members | 1,486 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Basic query help needed...

I'm a bit confused on how to use the query builder to create an
expression that will calculate gross revenue per gross unit using the
tables below:

table_1:
Product
PLtype (e.g., "Gross Units" or "Gross Rev")
PLamount

query results:
(Product), (gross rev/gross unit)

I know a pivot table might better handle this, but I'd like to know
how to do this without a pivot. Any suggestions are appreciated...
Nov 13 '05 #1
2 1189
John wrote:
I'm a bit confused on how to use the query builder to create an
expression that will calculate gross revenue per gross unit using the
tables below:

table_1:
Product
PLtype (e.g., "Gross Units" or "Gross Rev")
PLamount

query results:
(Product), (gross rev/gross unit)

I know a pivot table might better handle this, but I'd like to know
how to do this without a pivot. Any suggestions are appreciated...


I might select the product and a column summed for units and a column
for summed revenue and group on product.
Select Product, _
Sum(IIF([PLType]="Gross Units",PLAmount,0)) As Units, _
Sum(IIF([PLType]="Gross Rev",PLAmount,0)) As Revenue...

You end up with 3 cols, Product, Units, Rev and you can calculate as you
like.
Nov 13 '05 #2
Thanks! That gets me on the right track...
Salad <oi*@vinegar.com> wrote in message news:<_e*****************@newsread1.news.pas.earth link.net>...
John wrote:
I'm a bit confused on how to use the query builder to create an
expression that will calculate gross revenue per gross unit using the
tables below:

table_1:
Product
PLtype (e.g., "Gross Units" or "Gross Rev")
PLamount

query results:
(Product), (gross rev/gross unit)

I know a pivot table might better handle this, but I'd like to know
how to do this without a pivot. Any suggestions are appreciated...


I might select the product and a column summed for units and a column
for summed revenue and group on product.
Select Product, _
Sum(IIF([PLType]="Gross Units",PLAmount,0)) As Units, _
Sum(IIF([PLType]="Gross Rev",PLAmount,0)) As Revenue...

You end up with 3 cols, Product, Units, Rev and you can calculate as you
like.

Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Ryan Gaffuri | last post by:
I know that this works. I just don't get the syntax. I know its checking the OS. just not sure how it works. var v = navigator.appVersion.toUpperCase() if (1+v.indexOf('WIN98') os =...
1
by: jm | last post by:
I manually put a datagrid in on a form. I then added this code to an event to populate it: OdbcConnection conn = new OdbcConnection("DSN=CardBase"); sqlCardHolders = "SELECT * FROM...
2
by: Fay Yocum | last post by:
BEWARE beginner questions!! I have some experience in Access but never as much as I want or need. I have decided to get in on VB.Net. I would only rate myself in Access as a...
4
by: CSharpguy | last post by:
I'm not sure if this is the correct forum or not, but I have a basic question. Currently we have are doing calculations via stored procedures and then returning the results back to the client in...
6
by: JimmyKoolPantz | last post by:
I have been given the task of converting a program from VFP (visual foxpro) to Visual Basic.net. My question is "Is it possible to generate a DBF file Dynamically(at runtime) using Visual...
2
by: aashirwaads | last post by:
Hi Friends, I really need help from you people...I am a very new user of Oracle database...so need some basic tips from you... 1.What query do u type in sql*plus to see all the tables in a...
6
by: BJMurphy | last post by:
Hi All, I am used to other SQL engines, and have a few basic questions-- 1)If I wanted to conditionally drop a table, does SQL Server have a way to natively do this? Many SQL implementations...
1
by: Coll | last post by:
I'm working on a database that someone else created. I have a form - frm_main that is based on a query that is based on two tables. The join is such that the first table tbl_JCN has all records...
6
by: Vince | last post by:
Hello all, I am using Visual Basic to open a saved query and then save information in the query to an array for later use. The problem is that the same query shows different results when opened...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.