"DL Neil" <[EMAIL PROTECTED]> on 12/05/2001 11:35:46 PM
Internet mail from:

Please respond to "DL Neil" <[EMAIL PROTECTED]>
To:   <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]>
cc:

Subject:  Re: select statement group by unusual results


Chip,

> I have a database with 12 tables. I am running a query to select certain
> fields
> from 3 of the tables, like this -
>
> select Title, Details, StartDate, City, State
> from phpCalendar_Details, phpCalendar_Daily, phpCalendar_EventLocations
> where phpCalendar_Details.EventLocationID =
phpCalendar_EventLocations.EventLocationID
> group by City;
>
> The problem is the StartDate field data for the first returned row is
carried down through
> all the rows, rather than picking up the correct StartDate data. All the
other data is
> picked up correctly. When I change group by to State or Title or any
field, I get the same
> problem, whatever the first returned field, it is carried down through
all the rows. How do I
> get around this, or what am I doing wrong?

|From this can we assume (you don't give table schema) that StartDate is in
the |phpCalendar_Daily table and is
|the only field selected from that table?
|
|Take a look at the WHERE clause: the query is using three tables but only
joins two.
|
|Is that it?
|=dn

I guess I left a bit out. Here's the set up -
3 tables are phpCalendar_Details (fields are Title, Details),
phpCalendar_Daily (field StartDate) , phpCalendar_EventLocations (fields
are City, State). Two tables (_Details and _EventLocations)
have a common field - EventLocationID, the third table does not have a
field common to those two tables. I suppose I have to have one common to
all 3 to make it work?

--
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

Reply via email to