database & logic problem

Results 1 to 3 of 3

Thread: database & logic problem

  1. #1
    Snowyn Guest

    Default database & logic problem

    this is regarding database and some logic.i hope someone can help me.<BR>there are 3 tables: links, opentab & closedtab<BR>the records in links look like this:<BR>From To Distance<BR>A B 3<BR>A C 5<BR>B F 2<BR>C D 2<BR>i will select the first 2 records & put them in opentab.then from there i will select the shortest distance & remove it to put it in problem now is how do i make a query to select the subsequent link of B which is B to F, and subsequent link of C which is C to D from the links table to be insert into opentab? in other words the query has to know which record it selected previously.<BR>and another problem is if the 2 distance is the same (in the above case B-&#062;F,C-&#062;D)& by rule i should select B-&#062;F b&#039;cos its previous link gave a shorter distance. how do i select it by refering to the previous record selected?<BR>your help is highly appreciated.<BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: database & logic problem

    From what you are saying it seems that you want to select the smallest of all the values. If that is the case why not create a query that sorts all records in the table and then grab the top value which should correspond to the smallest distance?

  3. #3
    Snowyn Guest

    Default RE: database & logic problem

    do you mind showing me how to do that as my SQL is not very strong.thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts