Finding Max of two columns

  • Thread starter Thread starter ctreed
  • Start date Start date
C

ctreed

Guest
Hello gurus,

I have a table with the following information:

ID........Peak Demand....Off Demand
C005....425.................257
C005....302.................362
C005....324.................297
C005....346.................317
C005....335.................356
C005....313.................288


I want to create a query that will select the maximum of the two 'Demand' columns and populate a third, 'Max Demand' column:

ID........Max Demand...Peak Demand...Off Demand
C005....425...............425................257
C005....362...............302...............362
C005....324...............324...............297
C005....346...............346...............317
C005....356...............335...............356
C005....313...............313...............288


I don't believe there is anything complicated about this, but I've gone brain-dead, and am not coming up with a simple, elegant solution.

As always, thanks everyone for the great input!

ctreed
 
Add a column to the query and put this in the first line:

MaxDemand: IIf([PeakDemand]>[OffDemand],[PeakDemand],[OffDemand])

Change the names to the actual names of the fields in your table.

hth,
Jack
 
Thanks!

Thanks much!! That was exactly what I was looking for!

ctreed
 

Users who are viewing this thread

Back
Top Bottom