List:General Discussion« Previous MessageNext Message »
From:David McInnis Date:May 8 2002 4:21pm
Subject:RE: dates
View as plain text  
Actually since I don't know your data you might need:

select distinct mh.code,rubrica from multimedia_header mh, members_log
ml where  ml.member = 43 and now() > ml.date

now() returns the current datetime to the mysql query.

Can you show us the result set of:

select distinct mh.code,rubrica from multimedia_header mh, members_log
ml where  ml.member = 43

David

-----Original Message-----
From: Sandeep Murphy [mailto:sandeep.murphy@stripped] 
Sent: Wednesday, May 08, 2002 8:33 AM
To: 'David McInnis'; mysql@stripped
Subject: RE: dates


nope.. 

returns a empty resultset.... btw, what does the now() do??

thnx
-----Original Message-----
From: David McInnis [mailto:david@stripped]
Sent: quarta-feira, 8 de Maio de 2002 16:23
To: Sandeep Murphy; mysql@stripped
Subject: RE: dates


Try

select distinct mh.code,rubrica from multimedia_header mh, members_log
ml
where  ml.member = 43 and mh.date > now()

where mh.date is of type datetime

-----Original Message-----
From: Sandeep Murphy [mailto:sandeep.murphy@stripped] 
Sent: Wednesday, May 08, 2002 2:51 AM
To: 'mysql@stripped'; David McInnis
Subject: RE: dates

hi,

The query i had posted earlier-

select distinct mh.code,rubrica from multimedia_header mh, members_log
ml
where  ml.member = 43
and mh.date > ml.date

still doesnt execute as i want...The above query runs but returns a
resultset which includes a record within the same hour.. i.e. to say
that if
there is a difference of a day or more, the query runs fine but doesnt
take
into account the hours and minutes.. how can I rectify this?? 

thnx,
sands

-----Original Message-----
From: Jeremy Zawodny [mailto:jzawodn@stripped]
Sent: quarta-feira, 8 de Maio de 2002 6:25
To: David McInnis
Cc: Sandeep Murphy; mysql@stripped
Subject: Re: dates


On Tue, May 07, 2002 at 01:10:46PM -0700, David McInnis wrote:
>
> I would suggest doing "member = 43 and mh.date > ml.date" since
> there could potentially be more records that meet the second
> criteria.  I always try to optimize my queries to narrow my
> recordset as small as possible before I apply any other criteria.

That's good for human readability, but a good optimizer shouldn't
care.

> That said, MySQL may do this sort of optimization internally.  (I
> would be curious to know from more seasoned MySQL gurus if this is
> the case).

It is the case.  Next time you're messing with one of your queries,
run it through "EXPLAIN <query>" and see what is says.  Then change
the order of stuff in the WHERE clause and try again.  You should see
the same output.  If you don't, report it as a bug. :-)

Jeremy
-- 
Jeremy D. Zawodny, <jzawodn@stripped>
Technical Yahoo - Yahoo Finance
Desk: (408) 349-7878   Fax: (408) 349-5454   Cell: (408) 685-5936

MySQL 3.23.47-max: up 89 days, processed 2,319,227,600 queries (299/sec.
avg)

---------------------------------------------------------------------
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 <mysql-thread108317@stripped>
To unsubscribe, e-mail
<mysql-unsubscribe-david=dataovation.com@stripped>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


---------------------------------------------------------------------
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 <mysql-thread108374@stripped>
To unsubscribe, e-mail
<mysql-unsubscribe-david=dataovation.com@stripped>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


Thread
datesSandeep Murphy7 May
  • RE: datesDavid McInnis7 May
    • Re: datesJeremy Zawodny8 May
RE: datesSandeep Murphy8 May
  • RE: datesDavid McInnis8 May
RE: datesSandeep Murphy8 May
  • RE: datesDavid McInnis8 May
RE: datesSandeep Murphy8 May