Re: Order By Query - Simple Help

2002-01-30 Thread DL Neil

Ok Jon,

 I am setting up a small bidding system.  I have a table with one column for
 BID and the other for MAX_BID with each row having a unique id number.
 Anyone have a simple query example where I can select ID, BID, MAX_BID and
 sort in descending order the BID and MAX_BID as if it were one column?

 Example_tbl
 id bid max_bid
 1 .2 .4
 2 .1 .2
 3 .4 .0
 4 .4 .7
 5 .7 .7

 Selecting the id and creating X_BID in the query result which is the
 combined bid columns, ordering by the BID and MAX_BID

 Result_Set
 ID X_BID
 5 .7
 4 .7
 3 .4
 1 .4
 2 .2

 Make any sense ?  Any thoughts on the AS and ORDER BY for this ?


=Yes it makes sense, except that you haven't defined the term combined for the bid 
columns. May I take it to
mean 'max_bid if it exists, or bid otherwise'?

=1 Code the SQL as if you were wanting to list Result_Set using only max_bid, and 
label (AS) the max_bid column
CombinedBid.

=2 Now get the resultset into the desired sequence using CombinedBid.

=3 Finally deal with the selection of either max_bid or bid in the CombinedBid column 
- if max_bid  0, use
max_bid, else use bid.
- check out the manual for IF()


=Let us know how you get on,
=dn



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Order By Query - Simple Help

2002-01-29 Thread Jon Shoberg


Ok,
I am setting up a small bidding system.  I have a table with one column for
BID and the other for MAX_BID with each row having a unique id number.
Anyone have a simple query example where I can select ID, BID, MAX_BID and
sort in descending order the BID and MAX_BID as if it were one column?

Example_tbl
id  bid max_bid
1   .2  .4
2   .1  .2
3   .4  .0
4   .4  .7
5   .7  .7


Selecting the id and creating X_BID in the query result which is the
combined bid columns, ordering by the BID and MAX_BID

Result_Set
ID  X_BID
5   .7
4   .7
3   .4
1   .4
2   .2

Make any sense ?  Any thoughts on the AS and ORDER BY for this ?

Thanks





-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php