List:General Discussion« Previous MessageNext Message »
From:Sandeep Murphy Date:May 8 2002 9:50am
Subject:RE: dates
View as plain text  
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)
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