Jump to content

[SOLVED] Order By??


muat

Recommended Posts

I want to order the results of an SQL query by date 1st then by time. this will then alow me to insert records out of syen and for the report to still be correct.

 

my code is currently:

 

$sql33 = "SELECT * FROM fgqcdetails WHERE JobName = '$_GET[job]' ORDER BY CheckDate AND timeTake LIMIT $limitvalue, $limit";

 

this doesn't seem to be working!

Link to comment
Share on other sites

thay has helped, however my data is sill not in order

 

page 1

Date  25/07  25/07  25/07  25/07  25/07  25/07  25/07 25/07

Time  10.10  10.30  10.50  11.10  11.30  11.50  9.30  9.50

 

page 2

Date 29/07  29/07  29/07  29/07  29/07 29/07  29/07 29/07

Time 10.00  10.20  10.40  11.00  11.20  11.40  12.00 12.20

 

page 3

Date 29/07  29/07  29/07  29/07  29/07  29/07  29/07  29/07

Time 7.20    7.40    8.00  8.20    8.40    9.00    9.20    9.40

 

 

 

 

$sql4 = "SELECT * FROM fgqcdetails WHERE JobName = '$_GET[job]' ORDER BY CheckDate ASC, timeTake ASC LIMIT $limitvalue, $limit";

 

any thoughts??

 

 

Link to comment
Share on other sites

I have sorted it.

 

there was no problem with the sql.

 

the data type for the 'time' fiels was a varchar therefor the system was putting them in the correct order based on the 1st number only ie 1,2,7,8,9.

 

i channged the datat ype to a decimal (4,2) and it works perfectly.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.