Get the next large number in a access field

Local time
Today, 01:28
Joined
Jan 17, 2013
Messages
14
Hi, I have a data where I want to create a query fulfilling the below conditions. Suppose I have two table: Table 1 and Table 2 If a value ex.98 (Table1) matches with the value with 98(Table 2),it should pick up my second higher value 103. suppose 103 is the next high value of 98 . Please see the data value. misprepaid.asm value from Table2 Required Result Con 98 98 98 then 103 if value of table1=98 then 103from table 2 (next large number) 103 103 103 then 149 if value of table1=103 then 149from table 2 (next large number) 149 149 149 then 175 if value of table1=149 then 175from table 2 (next large number) 175 175 175 then 198 if value of table1=175 then 198from table 2 (next large number) 198 198 198 then 199 if value of table1=198 then 199from table 2 (next large number) 199 199 199 then 201 if value of table1=199 then 201from table 2 (next large number) 201 201 201 then 245 if value of table1=201 then 245from table 2 (next large number) 245 245 245 then 251 if value of table1=245 then 251from table 2 (next large number) 251 251 251 then 351 if value of table1=251 then 351from table 2 (next large number) 351 351 351 then 352 if value of table1=351 then 352from table 2 (next large number) 352 352 352 then 451 if value of table1=352 then 451from table 2 (next large number) 451 451 451 then 499 if value of table1=451 then 499from table 2 (next large number) 499 499 499 then 598 if value of table1=499 then 598from table 2 (next large number) 598 598 598 then 599 if value of table1=598 then 599from table 2 (next large number) 599 599 599 then 601 if value of table1=599 then 601from table 2 (next large number) 601 601 601 then 751 if value of table1=601 then 751from table 2 (next large number) 751 751 751 then 851 if value of table1=751 then 851from table 2 (next large number) 851 851 851 then 949 if value of table1=851 then 949from table 2 (next large number) 949 949 949 then 951 if value of table1=949 then 951from table 2 (next large number) 951 951 951 then 1251 if value of table1=951 then 1251from table 2 (next large number) 1251 1251 1251 then 1501 if value of table1=1251 then 1501from table 2 (next large number) 1501 1501 1501 then 1501 if value of table1=1501 then 1501from table 2 (next large number)
 
No offense.. But, WOW akashneelh.. just WOW :eek:

I wish I could understand what you are trying to say here. Could you scrap the whole thing and just in plain English explain what you are trying to do..

I am not sure anyone here would be able to help you out, with what you have presented..
 
Last edited:
Hi Actually the was not in this format ..I am resending my question
 
Hi, I have a data where I want to create a query fulfilling the below conditions. Suppose I have two table: Table 1 and Table 2. If a value ex.98 (Table1) ,it should pick up my second higher value 103 from my table 2. As 103 is the next higher value of 98 . Please see the data

Table1 Table2 Required Result
98 25 103
103 98 105
250 105 250
[FONT=&quot]330 260 null

Please check the attachment for reference
[/FONT]
 

Attachments

Get the next higher number in a access query

Hi, I have a data where I want to create a query fulfilling the below conditions. Suppose I have two table: Table 1 and Table 2 in an access.
Table1 contains two fields ACCOUNTNUMBER,MaxOfMRP
Table 2 contains only MRP field.
Now If I want to get the nearest higher value of
MaxOfMRP field from Table2.MRP field.What should i do for that. Please suggest.

If I wnat to check Maxof Mrp ex.98 (from Table1) ,it should pick up my second higher value 103 from my [table 2].[MRP'].
As 103 is the next higher value of 98 .
Please see attachment


Table1 Table2 Required Result
98 25 105
103 98 105
250 105 260
[FONT=&quot]330 260 null
[/FONT]
 

Attachments

Hi,

I think what you want is the following which uses a sub query:

SELECT Table1.MaxOfMRP, (select min(cards) from table2 as tmp where cards>table1.maxofmrp) AS T2Result
FROM Table1;

You should be able to copy this straight into your attachment.

Since this is a sub query you won't be able to update directly. Save it as a query then create a separate update query linking on table1.maxofmrp to query.maxofmrp

Please thank me if I'm right!
 
Thnx its a brilliant condition applied .....

Bingo...you have done this...
 

Users who are viewing this thread

Back
Top Bottom