RE: [PHP-DB] matching data from one table with another and displaying results?

2003-02-04 Thread SELPH,JASON (HP-Richardson,ex1)
Seek out LEFT JOIN on mysql web site, thats what you want.

Cheers
Jason

-Original Message-
From: Aaron Wolski [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 04, 2003 10:43 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] matching data from one table with another and
displaying results?


Hi All,
 
Having a problem figuring out the logic of something here and hoping
someone can point me in the right direction.
 
I have 2 tables.
 
First table holds a listing of all Provinces and States. Here a brief of
what it looks like:
 
value label 
 
 AB   Alberta 
 BC   British Columbia 
 MB  Manitobia 
 NF   Newfoundland 
 NT   Northwest Territories 
 NS   Nova Scotia  
 
Second Table is an OrderTable which holds all order and customer info
including the province/state. The province/state is dumped from the
value column of the ProvinceTable. Meaning.. an order record would
show the province as AB or NS instead of Alberta or Nova Scotia.
 
I am creating an order report and in this report I want to display the
LABEL name of the Province/State that relates to an the province column
in the OrderTable.
 
I could simply just display all provinces/states from the ProvinceTable
but then there would be entries for selection that had NO orders.
 
Any idea on this? Thanks guys!
 
Aaron
 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DB] matching data from one table with another and displaying results? SOLVED

2003-02-04 Thread Aaron Wolski
Solved the issue...

Just thought I'd post the query that did it.


$provinceQuery = db_query(SELECT * FROM ProvinceSelectTable AS t1,
OrderTable AS t2 WHERE t1.value=t2.province GROUP BY t2.province);


Thanks for any help thought to provide me :)

Aaron

-Original Message-
From: SELPH,JASON (HP-Richardson,ex1) [mailto:[EMAIL PROTECTED]] 
Sent: February 4, 2003 11:59 AM
To: Aaron Wolski; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] matching data from one table with another and
displaying results?

Seek out LEFT JOIN on mysql web site, thats what you want.

Cheers
Jason

-Original Message-
From: Aaron Wolski [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 04, 2003 10:43 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] matching data from one table with another and
displaying results?


Hi All,
 
Having a problem figuring out the logic of something here and hoping
someone can point me in the right direction.
 
I have 2 tables.
 
First table holds a listing of all Provinces and States. Here a brief of
what it looks like:
 
value label 
 
 AB   Alberta 
 BC   British Columbia 
 MB  Manitobia 
 NF   Newfoundland 
 NT   Northwest Territories 
 NS   Nova Scotia  
 
Second Table is an OrderTable which holds all order and customer info
including the province/state. The province/state is dumped from the
value column of the ProvinceTable. Meaning.. an order record would
show the province as AB or NS instead of Alberta or Nova Scotia.
 
I am creating an order report and in this report I want to display the
LABEL name of the Province/State that relates to an the province column
in the OrderTable.
 
I could simply just display all provinces/states from the ProvinceTable
but then there would be entries for selection that had NO orders.
 
Any idea on this? Thanks guys!
 
Aaron
 



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DB] matching data from one table with another and displaying results?

2003-02-04 Thread NIPP, SCOTT V (SBCSI)
I have a JOIN that is not working, and figured I would piggie-back on this
thread to see if someone could give me a quick answer...  Here is the JOIN
syntax.  This is my very first attempt at a JOIN statement, so I may be
doing something blatantly wrong here.

SELECT 'A.Title'
FROM `phpCalendar_Daily` AS 'B'
JOIN 'phpCalendar_Details' AS 'A' ON 'B.CalendarDetailsID' =
'A.CalendarDetailsID'
WHERE CURDATE( ) 
BETWEEN 'StartDate' AND 'StopDate'

I am attempting this from the SQL window of phpMyAdmin, so this is not
embedded somewhere in a script and failing.  Thanks in advance.

-Original Message-
From: SELPH,JASON (HP-Richardson,ex1) [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 04, 2003 10:59 AM
To: Aaron Wolski; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] matching data from one table with another and
displa ying results?


Seek out LEFT JOIN on mysql web site, thats what you want.

Cheers
Jason

-Original Message-
From: Aaron Wolski [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 04, 2003 10:43 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] matching data from one table with another and
displaying results?


Hi All,
 
Having a problem figuring out the logic of something here and hoping
someone can point me in the right direction.
 
I have 2 tables.
 
First table holds a listing of all Provinces and States. Here a brief of
what it looks like:
 
value label 
 
 AB   Alberta 
 BC   British Columbia 
 MB  Manitobia 
 NF   Newfoundland 
 NT   Northwest Territories 
 NS   Nova Scotia  
 
Second Table is an OrderTable which holds all order and customer info
including the province/state. The province/state is dumped from the
value column of the ProvinceTable. Meaning.. an order record would
show the province as AB or NS instead of Alberta or Nova Scotia.
 
I am creating an order report and in this report I want to display the
LABEL name of the Province/State that relates to an the province column
in the OrderTable.
 
I could simply just display all provinces/states from the ProvinceTable
but then there would be entries for selection that had NO orders.
 
Any idea on this? Thanks guys!
 
Aaron
 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php