473,395 Members | 2,798 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Query not sorting, but does on page refresh

219 100+
I have this query at the very top of my cfm file. It's right under the <body> tag. The date list which is returned from the query below isn't sorted in DESC order when the page first loads, but it does when you refresh the page. Why does this happen?

I'm sorry for these questions, but I don't know where else to ask really.

Expand|Select|Wrap|Line Numbers
  1. <cfquery name="getEDV2_dt" datasource="CodeGreyDW" dbtype="ODBC">
  2.  
  3.     SELECT tbledv2.date,tbledv2.time from tbledv2
  4.     UNION SELECT tbl3c.date,tbl3c.time from tbl3C
  5.     UNION SELECT tbl4.date,tbl4.time from tbl4
  6.     UNION SELECT tblcodegreydiv.date,tblcodegreydiv.time from tblcodegreydiv
  7.     UNION SELECT tblfosterwing.date,tblfosterwing.time from tblfosterwing
  8.     UNION SELECT tblicu.date,tblicu.time from tblicu
  9.     UNION SELECT tblmedsurg.date,tblmedsurg.time from tblmedsurg
  10.     ORDER by date DESC,time DESC
  11.  
  12. </cfquery>
  13.  
  14. <form method="post" action="BigPic_dt_v2.cfm?refDT=123">
  15.     </cfoutput>
  16.     <SELECT name="ed_dt">
  17.             <option>Select a Date/Time</option>
  18.             <cfoutput query="getEDV2_dt">
  19.                     <cfset ed_date=#DateFormat(date,"mm-dd-yy")#>
  20.                     <cfset ed_time=#TimeFormat(time,"HH:mm")#>
  21.                     <cfset DT=#ed_date# & ' ' & #ed_time#>
  22.             <option>#DT#</option>
  23.             <cfif isDefined("ed_dt")>
  24.             <cfset #PDT# = #ed_dt#>
  25.             </cfif>
  26.     </cfoutput>
  27.     </SELECT>
  28.     <cfoutput>
  29.         <cfif isDefined("ed_dt")>
  30.             <input type="hidden" name="refreshDT" value="#ed_dt#">
  31.         </cfif>
  32.     </cfoutput>
  33.     <input type="submit" value="Refresh">
  34.     <cfif isDefined("ed_dt")>
  35.         <cfset #CLIENT.ED_Date_Time# = #ed_dt#>
  36.     </cfif>
  37.     <cfoutput>PDT = #PDT#</cfoutput>
  38. </form>
  39.  
Sep 27 '07 #1

✓ answered by dmorand

It's probably your query which is the problem.

I'd have to test, but try using the 'as' keyword to rename fields.
Odd, but I just loaded the page up this morning, and it's sorting fine on the page load. My page is messing with me!!

4 2412
acoder
16,027 Expert Mod 8TB
It's probably your query which is the problem.

I'd have to test, but try using the 'as' keyword to rename fields.
Sep 28 '07 #2
dmorand
219 100+
It's probably your query which is the problem.

I'd have to test, but try using the 'as' keyword to rename fields.
Odd, but I just loaded the page up this morning, and it's sorting fine on the page load. My page is messing with me!!
Sep 28 '07 #3
acoder
16,027 Expert Mod 8TB
Odd, but I just loaded the page up this morning, and it's sorting fine on the page load. My page is messing with me!!
Don't you just hate it when that happens?
Sep 28 '07 #4
dmorand
219 100+
Don't you just hate it when that happens?
I really do because it was driving me crazy. I kept running the query in the Query Analyzer, and it worked fine no problems. Oh well, onto the next issue, haha.
Sep 28 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Phil Powell | last post by:
I created a page that will be doing image resizing and manipulation, which seems to work (using GD library). However, upon returning to the page where the image has been changed, I still see the...
11
by: Wolfgang Kaml | last post by:
Hello All, I have been working on this for almost a week now and I haven't anything up my sleeves anymore that I could test in addition or change.... Since I am not sure, if this is a Windows...
0
by: ck388 | last post by:
For some reason when I enable the callback feature of the gridview I still get a page refresh, that is it seems like there is a postback that occurs, not a callback which is just supposed to update...
7
by: Federico G. Babelis | last post by:
Hi All: I have this line of code, but the syntax check in VB.NET 2003 and also in VB.NET 2005 Beta 2 shows as unknown: Dim local4 As Byte Fixed(local4 = AddressOf dest(offset)) ...
4
by: Alan Lane | last post by:
Hello world: I'm including both code and examples of query output. I appologize if that makes this message longer than it should be. Anyway, I need to change the query below into a pivot table...
0
by: quang | last post by:
I have a subform within my results form that I use to display the results of my queries. Here is the problem: once the query has run and its results are displayed in my subform - if you make any...
1
by: Jeremy | last post by:
I want my gird to sort only the items on the current page when I click on a column header. I wrote a little test app, but when I sort it pulls in items from other pages and places them on the current...
3
by: Javilen | last post by:
Hello, I am looking for some Query Optimization help, We are running a web application that is growing experientially in traffic and we are not running into Problems with Deadlocks on the SQL...
3
by: nagmvs | last post by:
Hi to all I have one table with 6 columns and 20 rows.I want to sort each and every column when i click the column name in the table. for sorting i create one more page.when i click the column...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.