Origin _____Destination____Fares
Station A___Station B______$1.50
When a user select Station A as the Origin and Station B as the destination, the page will display the Fares which is $1.50, my problem is when user select Station B as the Origin and Station A as the destination, the Fares will be also $1.50, so how could I perform this without adding Station B as the origin and Station A as the destination in the Database because is the same thing ?
Thanks for helping.As a first cut, you could do something like this:
SELECT ... FROM table WHERE (Origin = 'A' OR Destination = 'A') AND (Origin = 'B' OR Destination = 'B')
Kinda ugly and I don't know how it will perform, but that should get you started.
Don|||this would be hard to do if you used a names like Station A and B.....if you where to use numbers like
Origin _____Destination____Fares
1_________2_____________$1.50
then you could do somethink like so
you can write a stored procedure that accepts a origin and destination....to determain which will be the origin and destination compair the two number...whatever one is less send it always as your origin...and send the second as your destination...just an idea....if you need me to explain any of the stuff i wrote i would be glad to.
Trey|||Thanks donkiely, it really works for me.
Thanks again.sql
No comments:
Post a Comment