473,395 Members | 1,677 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,395 software developers and data experts.

Comparing columns and doing something with the results in Access

Thanks ahead of time you’re your expert advice.
Here is the scenario: I have several Queries that finally end up like the following.

Filekey | Date | Last Name | First Name | Sum of dollars | Sum of dollars |
186 |1/1/2007| | testlast| |testfirst| |109.95| |97.50|

I would like to compare the last two columns and make a new table named transactions that stores the following:

Filekey | Date | Last Name | First Name | sum of largest dollars |
186 |1/1/2007| |testlast| |testfirst| |109.95|
Nov 16 '07 #1
7 1438
Rabbit
12,516 Expert Mod 8TB
Why do you need to store the result in a table, why not just use a query.

In either case, you're looking for the iif() function.
Nov 16 '07 #2
Why do you need to store the result in a table, why not just use a query.

In either case, you're looking for the iif() function.
OK Thanks.... I do not really need to store it. I fugure when the transactions get to over 10,000 it would be faster to pull up pree quired data then run a compare iif() statment against all 10,000. Either way can you give me a usage example please.

Thanks!
Nov 16 '07 #3
Rabbit
12,516 Expert Mod 8TB
OK Thanks.... I do not really need to store it. I fugure when the transactions get to over 10,000 it would be faster to pull up pree quired data then run a compare iif() statment against all 10,000. Either way can you give me a usage example please.

Thanks!
Well, the problem with storing it is what happens if the original numbers get changed? You'll end up having to run the make table query over again anyways. You can't expect the numbers to be static once they've been entered and the table's been created. I suppose it's different if you're looking at a static data set but I don't think that's the case here.

Expand|Select|Wrap|Line Numbers
  1. iif(Conditional Statement, Value if True, Value if False)
  2.  
Nov 16 '07 #4
Well, the problem with storing it is what happens if the original numbers get changed? You'll end up having to run the make table query over again anyways. You can't expect the numbers to be static once they've been entered and the table's been created. I suppose it's different if you're looking at a static data set but I don't think that's the case here.

Expand|Select|Wrap|Line Numbers
  1. iif(Conditional Statement, Value if True, Value if False)
  2.  
That makes since and the initial queries that get us to this poing will narrow down the data to a few hundred rechords anyways. I dont believe I have ever used the iif() statment. In the seniro I gave you can yougive me an idea of how I would use this statment ina query please.

Thanks Alot!

would I do
Expand|Select|Wrap|Line Numbers
  1. SELECT * 
  2. from query1
  3. where iif(sum1 < sum2, ......
or what should I do?
Nov 16 '07 #5
Rabbit
12,516 Expert Mod 8TB
Please use the code tags.

Not quite, you're looking to create a new column right?
Expand|Select|Wrap|Line Numbers
  1. SELECT *, iif(Sum1 > Sum2, Sum1, Sum2) AS LargestSum
  2. FROM SomeQueryContainingSum1AndSum2;
  3.  
Nov 16 '07 #6
Please use the code tags.

Not quite, you're looking to create a new column right?
Expand|Select|Wrap|Line Numbers
  1. SELECT *, iif(Sum1 > Sum2, Sum1, Sum2) AS LargestSum
  2. FROM SomeQueryContainingSum1AndSum2;
  3.  
Sorry about the code thing. You are so AWESOME!!!!! It worked great! Thanks so much. I am so amazed someone like me can get this kind of support for free. What can I do to give back?
Nov 16 '07 #7
Rabbit
12,516 Expert Mod 8TB
It's not a problem. Where would any of us be without some help when we start out? If you wish to give back, try answering some of the other user's questions. It's a win/win because I have learned way more from answering questions by testing out my solutions than I have from asking questions.
Nov 16 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: ArunPrakash | last post by:
Hi, I have 2 tables and each has a text column. When i compared the 2 columns with the LIKE operator i found something strange. create table test1( var1 text ) create table test2( var1 text ) ...
41
by: Odd-R. | last post by:
I have to lists, A and B, that may, or may not be equal. If they are not identical, I want the output to be three new lists, X,Y and Z where X has all the elements that are in A, but not in B, and...
3
by: Dave | last post by:
Hello I've created a student database for our program that I also need to get statistics from. It's in Access 2003. The statistics would be things like Male-Female percentage, percentage of...
4
by: Frank | last post by:
Hello, Developing an app where the user fills out a sometimes quite lengthy form of chkboxes, txtboxes, radbtns, etc. User responses are saved to a mySql db, which the user can later edit. When...
6
by: lanwrangler | last post by:
I know it's a long shot but does anyone have any pointers to generic algorithms - or, even better, Python code - for comparing images and computing a value for the "difference" between them? ...
10
by: saravanand | last post by:
Dear All, I am new to Ms Access and I am doing Product Hierarchy in SAP. I have to check for redundancy of datas from the SAP system and from another file. Difference found in code or description is...
0
by: saravanand | last post by:
Dear All, I am new to Ms Access and I am doing Product Hierarchy in SAP. I have to check for redundancy of datas from the SAP system and from another file. Difference found in code or description is...
1
by: Yas | last post by:
Hello, I currently have Table1 and View1. View1 is a query from 2 or 3 tables that works fine on its own. However in my current query if I try to use it...something like... SELECT a.col1,...
2
by: sumuka | last post by:
Hello Everyone, I'm doing a project in VB 6.0 and i've a flexgrid which contains some numerical values in it's cell now i need to compare these values present in flexgrid with the values in...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.