× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I'm revisiting my initial code and I realize I don't quite understand the business rules.

It could be as simple as "return the row for each ID that contains the lowest value for N1, and the row that contains the lowest value for N2". But that wouldn't require you to say "if n2 is not 0, I ignore the value of n1".

In the case below, why is the row [c1, 4, 0] included? Because it contains 4 in n1, or because it contains 0 in n2?

Why don't you include [c1, 4, 5]? I don't understand the phrase "should return 2 lines containing 4". There are 3 lines containing 4.

How about adding a few more lines to the test case and explaining the result.

If you add [c1, 2, 0] what are the results?

If you add [c1, 2, 5] what are the results?

Joe
Hi all,
I need to scan this table and get the lines having the lowest value for n1 or n2

id n1 n2
c1 4 0
c1 3 4
c1 4 5
c1 5 6

If n2 is not 0, I ignore the value of n1.

So in this example I should return 2 lines containing 4 :

c1 4 0
c1 3 4

Thanks


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.