"DL Neil" <[EMAIL PROTECTED]> on 12/06/2001 05:27:55 PM
Internet mail from:
Please respond to "DL Neil" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
cc: <[EMAIL PROTECTED]>
Subject: Re: select statement group by unusual results
Hi Chip,
> Thanks for the tips. So here's my latest attemp:
>
> select distinct Title, Details, StartDate, StopDate, City, State
> from phpCalendar_Details t1, phpCalendar_Daily t2,
phpCalendar_EventLocations t3
> where t1.LocationID = t2.LocationID
> and t1.EventLocationID = t3.EventLocationID
> group by StartDate;
>
> And this one works! Amazing, my first attempt at a join statement.
|=it works, great! Join our happy throng of MySQL-ers!
|
|but...
|(I'm going to make loads of assumptions because you have changed the
schema of two or even |all three of the
|involved tables (since describing them before) - it works, so that's not
bothering me)
|What is?
|1 why use DISTINCT?
|ie what do you think it is contributing to the query result?
Actually, it isn't contributing anything, it was left over from my
experimenting. I
took it out and it still works fine.
|2 why use GROUP BY?
|ie what do you want to happen if there is more than one event starting on
the same date?
Turns out the results are slightly differant with or withou group by - I
get 20 results
with group by and 32 results without it.
I should only be getting 20 results, right now I don't have time to figure
out where the
odd results are coming from when not using group by. I'll check into that
later.
|Yes relational algebra can be fun - provided you didn't sleep through set
theory etc at |school.
Relational aglebra? I haven't a clue what that is. Set theory? Don't know
what that is
either.
|Congratulations
|on your success, that is an "inner join" and in fact is also a "equi-join"
(and there's |plenty of other jargon
|that you can use to describe it). Your first example had a join in its
WHERE clause too - |did you mean that this
|is your first multi-way join?
This is the first join of any type I have had to make. So far my databases
have been
simple with just a single table. This one in particular I got off the web,
it's a
calendar app, quite nice one too,from appIdeas.com. I have to send the data
in csv to
our parent company in Norway. I'm also doing a dump just so they get
everything.
I don't know what they're using for sql server or just exactly they want
from me, they
just want the data. (They're taking some of my work away from me, the dirty
rats) :-(
|Now is the time when all good (wo)men go out and pick up a |decent text
and get
|stuck in...
|
|Regards,
|=dn
I picked up a book called MySQL/PHP Database Applications by Greenspan &
Bulger, seems
to pretty good, and a couple other php books that have a little mysql
stuff.
--
Regards,
Chip
---------------------------------------------------------------------
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 <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php