February 12, 2002

Looking at your table definition, you're using varchar for time and date, 
so these are stored as character strings, so the "order by" will sort them 
like strings, so naturally 10 comes before 2.

Regards,

Mike Anderson

On Tuesday, February 12, 2002 7:37 AM, Jake McHenry 
[SMTP:[EMAIL PROTECTED]] wrote:
> This is exactly what I'm doing! Here is my query ..
>
> select * from $dbtable where 1 and year = '$inyear' and month like
> '$inmonth' and day = '$inday' order by time, ampm
>
> And when I display the results, it is putting a event of 10:00 am or pm
> before 2-9 am or pm. it's putting the 10 before all.
>
>
> Here is a screen shot of the output..
>
>       Time AM/PM Event Delete
>       10:00 AM test
>       10:00 PM test
>       1:00 PM test
>       5:00 AM test
>       8:00 PM test
>       9:00 AM test
>       9:30 AM test
>
>             Check All
>         Password:
>
>
> Thanks,
> Jake
>
>
> ----- Original Message -----
> From: "Pieter De Wit" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, February 11, 2002 11:26 PM
> Subject: Re: MySQL Question
>
>
> > Hello Jake,
> >
> > 1) What is the query that you are using ?
> > 2) Why don't you use a date/time field (can't remeber if mysql has one
> :) )
> >
> > Your query should look something like this :
> >
> > select * from <table> order by time,ampm;
> >
> > Cheers,
> >
> > Pieter
> >
> > ----- Original Message -----
> > From: Jake McHenry
> > To: RedHat List
> > Sent: Tuesday, February 12, 2002 3:26 AM
> > Subject: MySQL Question
> >
> >
> > I know this isn't the right place for this, but I'm hoping someone can
> help
> > me out.  I have created a database, basically an online calendar, and I
> have
> > the following fields in my table..
> >
> > id  int(10)  auto_increment
> > year  int(4)
> > month  varchar(10)
> > day  int(2)
> > time  varchar(5)
> > ampm  char(2)
> > event  varchar(255)
> >
> > Where I'm running into a problem is on the output screen. I've tried
> sorting
> > by day, time, and ampm, and all of these, but I'm still running into 
the
> > same problem.
> > The problem is that an entry of time 10:00 am is coming before 10:00 
pm,
> > it's because of the 1 in the entry, I think. Anyway, can anyone tell me
> how
> > I can get the entries to be listed in sequential order by time and 
ampm?
> >
> > I've also tryed putting the year, month, day, and time into a datetime
> > field, but I still have the same problem.
> >
> > Thanks,
> > Jake
> >
> >
> >
> > _______________________________________________
> > Redhat-list mailing list
> > [EMAIL PROTECTED]
> > https://listman.redhat.com/mailman/listinfo/redhat-list
> >
> >
>
>
>
>
> _______________________________________________
> Redhat-list mailing list
> [EMAIL PROTECTED]
> https://listman.redhat.com/mailman/listinfo/redhat-list



_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to