RE: [PHP-DB] Left Join

2011-08-07 Thread Toby Hart Dyke
August 07, 2011 9:33 PM To: Peter Lind Cc: php-db@lists.php.net Subject: Re: [PHP-DB] Left Join >On Sun, Aug 7, 2011 at 3:00 PM, Peter Lind wrote: > >Maybe it's just me, but I can't see anything that would work as >foreign key for you to join on - neither table seems to have a foreign

Re: [PHP-DB] Left Join

2011-08-07 Thread Chris Stinemetz
>On Sun, Aug 7, 2011 at 3:00 PM, Peter Lind wrote: > >Maybe it's just me, but I can't see anything that would work as >foreign key for you to join on - neither table seems to have a foreign > >key > Sorry for my ignorance. How do I create the foreign key? The two columns from each table that h

Re: [PHP-DB] Left Join

2011-08-07 Thread Peter Lind
Maybe it's just me, but I can't see anything that would work as foreign key for you to join on - neither table seems to have a foreign key On 7 August 2011 21:53, Chris Stinemetz wrote: > I am tyring to build a query that will take the most recent > "stores.store_date" column then join it with "s

[PHP-DB] Left Join

2011-08-07 Thread Chris Stinemetz
I am tyring to build a query that will take the most recent "stores.store_date" column then join it with "store_list.store_name" where store_list.store_name and stores.store_subject match then return the most recent "stores.store_date". I am guessing this will require some sort of join. I have been

[PHP-DB] LEFT JOIN query help

2010-07-18 Thread Ron Piggott
I am writing a Bible trivia application. I am trying to write the mySQL query that will select the next question reference number and the current question is answered. The value I want to retrieve It is in the field: `verse_of_the_day_Bible_trivia`.`reference` I don't think I have my LEFT JOIN'

[PHP-DB] Left Join with more than two tables......

2003-08-14 Thread Michael Cortes
I know that we can .. select last_name,first_name, table2.school from table1 left join table2 on school_id=bldg_id Listing all students and giving the school name for all students, if they have one. If not, it lists the kid anyway and leaves that field blank. Anyhow, how about multiple ta

Re: [PHP-DB] Left Join with more than two tables......

2003-08-14 Thread Michael Cortes
Thanks. I couldn't find the correct syntax in my resources. I tried at one point to use commas like: select * from table1 left join table2,table3 on table1.id=table2.id,table1.id=table3.id Thanks again for the correct syntax. On Tuesday 12 August 2003 04:00 pm, Brent Baisley wrote: > The left

Re: [PHP-DB] Left Join with more than two tables......

2003-08-14 Thread Brent Baisley
The left join works the same for two or more tables. select * from table1 left join table2 on table1.id=table2.id left join table3 on table1.id=table3.id ... Just specify the table you want to join and what to use to join them. On Tuesday, August 12, 2003, at 03:16 PM, Michael Cortes wrote: I kno

Re: [PHP-DB] LEFT JOIN not working

2003-01-15 Thread Ignatius Reilly
. Ignatius - Original Message - From: "Henrik Hornemann" <[EMAIL PROTECTED]> To: "Ignatius Reilly" <[EMAIL PROTECTED]> Cc: "PHP-DB" <[EMAIL PROTECTED]> Sent: Wednesday, January 15, 2003 10:56 AM Su

SV: [PHP-DB] LEFT JOIN not working

2003-01-15 Thread Henrik Hornemann
18:47 Til: Ignatius Reilly Cc: PHP-DB Emne: Re: [PHP-DB] LEFT JOIN not working Still not working. I made the change, and I'm still getting all results. I even tried it without the leading '0' in front of the 1, no good. Here's my current query, with suggested changes: SELE

Re: [PHP-DB] LEFT JOIN not working

2003-01-14 Thread Miles Thompson
= '01' (if your table ads_displayrate has such date fields). HTH Ignatius - Original Message - From: "Lisi" <[EMAIL PROTECTED]> To: "Ignatius Reilly" <[EMAIL PROTECTED]> Sent: Thursday, January 09, 2003 6:54 PM Subject: Re: [P

Re: [PHP-DB] LEFT JOIN not working

2003-01-14 Thread Lisi
H(ads_displayrate.date) = '01' (if your table ads_displayrate has such date fields). HTH Ignatius - Original Message - From: "Lisi" <[EMAIL PROTECTED]> To: "Ignatius Reilly" <[EMAIL PROTECTED]> Sent: Thurs

Re: [PHP-DB] LEFT JOIN not working

2003-01-09 Thread Ignatius Reilly
L PROTECTED]> To: "Ignatius Reilly" <[EMAIL PROTECTED]> Sent: Thursday, January 09, 2003 6:54 PM Subject: Re: [PHP-DB] LEFT JOIN not working > Cool! It's mostly working now, the only problem is it's ignoring the other > clauses in the ON clause that select the d

Re: [PHP-DB] LEFT JOIN not working

2003-01-09 Thread Ignatius Reilly
m?" D. Ivester, CEO, Coca Cola - Original Message - From: "Lisi" <[EMAIL PROTECTED]> To: "Ignatius Reilly" <[EMAIL PROTECTED]>; "PHP-DB" <[EMAIL PROTECTED]> Sent: Thursday, January 09, 2003 1:11 PM

Re: [PHP-DB] LEFT JOIN not working

2003-01-09 Thread Lisi
uot;) Ignatius - Original Message - From: "Lisi" <[EMAIL PROTECTED]> To: "Ignatius Reilly" <[EMAIL PROTECTED]>; "PHP-DB" <[EMAIL PROTECTED]> Sent: Thursday, January 09, 2003 12:18 PM Subject: Re: [PHP-DB] LEFT JOIN not working > OK

Re: [PHP-DB] LEFT JOIN not working

2003-01-09 Thread Ignatius Reilly
ads_clickrate.date IS > >NULL, 0, 1 ) ) > > > >HTH > >Ignatius > >____ > >- Original Message - > >From: "Lisi" <[EMAIL PROTECTED]> > >To: "PHP-DB" <[EMAIL PROTECTED]> >

Re: [PHP-DB] LEFT JOIN not working

2003-01-09 Thread Lisi
Try replacing COUNT(ads_clickrate.date) by SUM( IF( ads_clickrate.date IS NULL, 0, 1 ) ) HTH Ignatius - Original Message - From: "Lisi" <[EMAIL PROTECTED]> To: "PHP-DB" <[EMAIL PROTECTED]> Sent: Thursday, January 09

Re: [PHP-DB] LEFT JOIN not working

2003-01-09 Thread Ignatius Reilly
oup). Try replacing COUNT(ads_clickrate.date) by SUM( IF( ads_clickrate.date IS NULL, 0, 1 ) ) HTH Ignatius - Original Message - From: "Lisi" <[EMAIL PROTECTED]> To: "PHP-DB" <[EMAIL PROTECTED]> Sent: Thursday,

[PHP-DB] LEFT JOIN not working

2003-01-09 Thread Lisi
I have a page with many ads that stores both the number of times an ad is displayed and how many times it gets clicked. These are stored in two different tables (since different information is stored for each) but both have identical name columns. I am trying to display both # times displayed

[PHP-DB] LEFT JOIN in UPDATE

2002-02-03 Thread Adv. Systems Design
hi...trying to circumvent the limitation of the DELETE statement only being able to use its own table...idea is to mark the records to be deleted via an UPDATE statement which allegedly accepts LEFT JOIN and then performing the DELETE statement. Question is how to properly form a LEFT JOIN using

RE: [PHP-DB] Left Join is producing duplicate results - MySQL & relational tables

2001-07-12 Thread Matthew Loff
2, 2001 10:48 AM To: Matthew Loff Cc: 'Dobromir Velev'; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [PHP-DB] Left Join is producing duplicate results - MySQL & relational tables Hi Matthew, Matthew Loff wrote: > What about... > SELECT WLPbib.bibID, >

Re: [PHP-DB] Left Join is producing duplicate results - MySQL & relational tables

2001-07-12 Thread Mike Gifford
h SQL, so perhaps someone can better > elaborate. I think that you did a good job.. However I think I'm still stuck with the same duplicate error now (well when I've expanded the code. Mike > -Original Message----- > From: Dobromir Velev [mailto:[EMAIL PROTECTED]]

Re: [PHP-DB] Left Join is producing duplicate results - MySQL & relational tables

2001-07-12 Thread Mike Gifford
Hello Dobromir, Dobromir Velev wrote: > Did you try to use something like this. > mysql_query("SELECT DISTINCT >WLPbib.bibID, The only item that I want to have distinct is the first one. However, I think that Matthew's response (to your response) is working now. > The other thing t

RE: [PHP-DB] Left Join is producing duplicate results - MySQL & relational tables

2001-07-11 Thread Matthew Loff
. Best of luck! -Original Message- From: Dobromir Velev [mailto:[EMAIL PROTECTED]] Sent: Thursday, July 12, 2001 3:01 AM To: [EMAIL PROTECTED]; Mike Gifford Subject: Re: [PHP-DB] Left Join is producing duplicate results - MySQL & relational tables Hi, Did you try to use something like this.

Re: [PHP-DB] Left Join is producing duplicate results - MySQL & relational tables

2001-07-11 Thread Dobromir Velev
this helps Dobromir Velev -Original Message- From: Mike Gifford <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] <[EMAIL PROTECTED]> Date: Thursday, July 12, 2001 4:31 AM Subject: [PHP-DB] Left Join is producing duplicate results - MySQL & relational tables >Hello, > >I p

Re: [PHP-DB] Left Join is producing duplicate results - MySQL & relational tables

2001-07-11 Thread Mike Gifford
n drop that SQL into my script. > > HTH > Beau > > // -Original Message- > // From: Mike Gifford [mailto:[EMAIL PROTECTED]] > // Sent: Thursday, 12 July 2001 11:01 AM > // To: Ken > // Cc: [EMAIL PROTECTED] > // Subject: Re: [PHP-DB] Left Join is producing duplic

RE: [PHP-DB] Left Join is producing duplicate results - MySQL & relational tables

2001-07-11 Thread Beau Lebens
into my script. HTH Beau // -Original Message- // From: Mike Gifford [mailto:[EMAIL PROTECTED]] // Sent: Thursday, 12 July 2001 11:01 AM // To: Ken // Cc: [EMAIL PROTECTED] // Subject: Re: [PHP-DB] Left Join is producing duplicate // results - MySQL & // relational tables // //

Re: [PHP-DB] Left Join is producing duplicate results - MySQL & relational tables

2001-07-11 Thread Kevin Johnson
fford" <[EMAIL PROTECTED]> To: "Ken" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Wednesday, July 11, 2001 08:00 PM Subject: Re: [PHP-DB] Left Join is producing duplicate results - MySQL & relational tables > Sorry Ken, > > I'm trying to l

Re: [PHP-DB] Left Join is producing duplicate results - MySQL & relational tables

2001-07-11 Thread Mike Gifford
Sorry Ken, I'm trying to learn a few too many things at once. Switching it around eliminated the error message but not the duplication. I'm eliminating as much of the code as I can to see that it isn't coming from PHP. Thanks again for your help. Mike Ken wrote: > In general, you should al

Re: [PHP-DB] Left Join is producing duplicate results - MySQL & relational tables

2001-07-11 Thread Ken
Mike - In general, you should always be reading the manual first. From the SELECT syntax at http://www.mysql.com/doc/S/E/SELECT.html GROUP BY must be indicated before ORDER BY. So reverse the order of those portions. - Ken At 10:35 PM 7/11/01 -0400, Mike Gifford wrote: >It looked good, but it

Re: [PHP-DB] Left Join is producing duplicate results - MySQL & relational tables

2001-07-11 Thread Mike Gifford
It looked good, but it gave me an error.. Sorry Database error: Invalid SQL: SELECT WLPbib.bibID, WLPbib.title, WLPbib.publisher, WLPbib.publicationDate, WLPaddress.city, WLPaddress.state, WLPprofile.firstName, WLPprofile.l

Re: [PHP-DB] Left Join is producing duplicate results - MySQL & relational tables

2001-07-11 Thread Ken
Mike - I'm not certain but it sounds like you might be looking for "GROUP BY". Do GROUP BY and then the columns that are identical in your results. - Ken At 09:46 PM 7/11/01 -0400, Mike Gifford wrote: >Hello, > >I posted this to the general list this morning & got a couple of good leads, but

[PHP-DB] Left Join is producing duplicate results - MySQL & relational tables

2001-07-11 Thread Mike Gifford
Hello, I posted this to the general list this morning & got a couple of good leads, but they weren't able to actually fix the problem, so I'm posting here to the db list. I'm making some headway on joining three MySQL tables. However, when I run this query: mysql_query("SELECT WLPbib.b