Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Comparing and getting lowest value from Tables

Status
Not open for further replies.

TSeerveld

IS-IT--Management
Oct 24, 2011
2
US
I have several price tables that I want to comapare and get the lowest value between them, I also don't want it to compare NULL fields.

At a loss here.
 
Do you have more than two tables containing prices (you mention "several")? Do you already have the tables linked with some main table so that they are returning accurate data?

You could replace each price field with a formula like this:

//{@priceA}:
if isnull({tableA.price}) then
999999999 else
{tableA.price}

Then you can use a formula like this to return the lowest value:

minimum([{@priceA},{@priceB},{@priceC}])

-LB
 
There are 10 tables.
I tried to place them into an Array [,] and use the MIN command onthem, but the Blanks and 0 values are throwing it off. I need a value that will return a compared lowest value from all ten fields.
 
Replace each field in the array with a formula like this:

//{@priceA}:
if isnull({tableA.price}) or
{tableA.price} = 0 then
999999999 else
{tableA.price}


-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top