That's true. UserID is unique and makes everything else in ORDER BY useless but what should I do? Cause group in cfoutput needs UerID. Please help me. Thanks benign
On 2/20/08, Dave Francis <[EMAIL PROTECTED]> wrote: > ORDER BY Tbl_Dogs.DogID, Tbl_Users.UserID, Tbl_DogPurchWait.DogPurchWaitDate > Desc</cfquery> > > It looks like Tbl_Users.UserID might be unique in the ORDER BY line, thus > rendering any sort order after that useless. > > -----Original Message----- > From: Ali [mailto:[EMAIL PROTECTED] > Sent: Tuesday, February 19, 2008 6:16 PM > To: CF-Talk > Subject: How to sort columns and Group them at the same time > > > Hi: > The main problem here is: > I have a table of orders. Several users may order one Pet(this a part of a > pet shop) but one will get it. I use Group in <Cfoutput> to place all the > users who ordered one pet under each pet. It works fine but I had to put the > columns I want group in ORDER BY of the sql. I need to sort these users > using date to prioritize their orders (the one who ordered first has more > chance surely). But when I put date in ORDER BY it seems that sql ignores it > all! Please help me find a way to sort the outcome using date. > Thanks > Benign > > this is the code: > > <cfquery name="rsPurch_List" datasource="#Request.DSN#"> > SELECT Tbl_DogPurchWait.DogPurchWaitID > ,Tbl_DogPurchWait.UserID > ,Tbl_DogPurchWait.DogID > ,Tbl_DogPurchWait.DogPurchWaitDate > ,Tbl_DogPurchWait.DogPurchWaitActive > ,Tbl_Users.UserName > ,Tbl_Users.FistName > ,Tbl_Users.LastName > ,Tbl_Users.TelephoneNumber > ,Tbl_Users.EmailAddress > ,Tbl_Dogs.DogNumber > ,Tbl_Dogs.DogName > ,Tbl_Dogs.DogImageS1 > ,Tbl_Users.UserID > ,Tbl_Dogs.DogID > ,Tbl_Dogs.DogPrice > ,Tbl_Users.Address > FROM Tbl_DogPurchWait, Tbl_Users, Tbl_Dogs > WHERE Tbl_Dogs.DogID = Tbl_DogPurchWait.DogID > AND Tbl_DogPurchWait.UserID = Tbl_Users.UserID > AND Tbl_DogPurchWait.DogPurchWaitActive = YES > ORDER BY Tbl_Dogs.DogID, Tbl_Users.UserID, Tbl_DogPurchWait.DogPurchWaitDate > Desc</cfquery> > > <cfoutput query="rsPurch_List" group="Tbl_Dogs.DogID"> > <table width="50%" border="0" align="right" cellpadding="5" > cellspacing="0" dir="rtl"> > <tr> > <td><img src="../#rsPurch_List.DogImageS1#" /></td> > <td>#rsPurch_List.DogName#</td> > <td>#rsPurch_List.DogNumber#</td> > <td>#rsPurch_List.DogPrice#</td> > </tr> > </table> > <cfoutput group="Tbl_Users.UserID"> > <table width="100%" border="1" align="right" cellpadding="5" cellspacing="0" > bordercolor="##000000" dir="rtl"> > <tr> > <td align="center"> > <li> > <a > href="/dampezeshki_final/dog/Admin/AdminPurchConf_Insertion.cfm?DogPurchWait > ID=#rsPurch_List.DogPurchWaitID#">#rsPurch_List.UserName#</a> > </li> </td> > <td >#rsPurch_List.FistName#</td> > <td>#rsPurch_List.LastName#</td> > <td>#rsPurch_List.TelephoneNumber#</td> > <td>#rsPurch_List.EmailAddress#</td> > <td>#rsPurch_List.Address#</td> > <td>#rsPurch_List.DogPurchWaitDate#</td> > </tr> > </table> > </cfoutput> </h1> > </cfoutput> > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:299394 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

