Re: [PHP-DB] Relational database

2002-03-22 Thread Cirstoiu Aurel Sorin

test



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




Re: [PHP-DB] Relational database

2002-03-22 Thread Andrey Hristov

Otidi tuk : http://www.php.net/unsub.php i vig kak se pravi Unsubscribe

Andrey

- Original Message - 
From: "Stefan" <[EMAIL PROTECTED]>
To: "'Andrey Hristov'" <[EMAIL PROTECTED]>; "'Ron'" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Friday, March 22, 2002 10:37 AM
Subject: RE: [PHP-DB] Relational database


> Dear friends at [EMAIL PROTECTED],
> 
> I am an innocent guy from Bulgaria and somehow I got in to your mailing
> list ([EMAIL PROTECTED] & [EMAIL PROTECTED]). Now I got all of your
> mails and I am sure this is a mistake.
> 

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




Re: [PHP-DB] Relational database

2002-03-21 Thread Mike Maltese

Try this:

SELECT Description, Impact, Isolation FROM ccsd NATURAL JOIN log

or

SELECT Description, Impact, Isolation FROM ccsd LEFT JOIN log USING(logccsd)

Just add on a WHERE conditional to get the required results if necessary.


- Original Message -
From: "Ron" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, March 21, 2002 5:32 AM
Subject: [PHP-DB] Relational database


> I am trying to get fields from 2 different tables that have the same field
> name to pull the records from one table
> For example
> mysql_connect($DBhost,$DBuser,$DBpass) or die("Unable toconnect to
> database");
> @mysql_select_db("$DBName") or die("Unable to select database $DBName");
> $sqlquery1 = mysql_query("SELECT Description, Impact, Isolation" .
> "FROM ccsd, log WHERE ccsd=log.logccsd");
>
> while ($query = mysql_fetch_array($sqlquery1)) {
>  $CCSD = $query["CCSD"];
>  $Description = $query["Description"];
>  $Impact = $query["Impact"];
>  $Isolation = $query["Isolation"];
> }
> This code is not working.help please.yes I am a newbie!
>
>
>
> --
> 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




Re: [PHP-DB] Relational database

2002-03-21 Thread Andrey Hristov

The info is not full but I'll try to help. Lets say the name of the field in the two 
tables is common_field.
Then we do
SELECT all_that_is_needed FROM table1,table2 WHERE 
table1.common_field=table2.common_field;
And an optimized variant:
SELECT all_that_is_needed FROM table1 LEFT JOIN table2 USING(common_field);
If in the two tables we have two columns with equal data but with different names then 
we do:
SELECT all_that_is_needed FROM table1 LEFT JOIN table2 ON 
table1.common_field_name_table1=table2.common_field_name_table2;
So 
SELECT all_that_is_needed FROM table1 LEFT JOIN table2 USING(common_field);
is equal to:
SELECT all_that_is_needed FROM table1 LEFT JOIN table2 ON 
table1.common_field=table2.common_field;

Hope that is clear.

Best regards,
Andrey

- Original Message - 
From: "Ron" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, March 21, 2002 3:32 PM
Subject: [PHP-DB] Relational database


> I am trying to get fields from 2 different tables that have the same field
> name to pull the records from one table
> For example
> mysql_connect($DBhost,$DBuser,$DBpass) or die("Unable toconnect to
> database");
> @mysql_select_db("$DBName") or die("Unable to select database $DBName");
> $sqlquery1 = mysql_query("SELECT Description, Impact, Isolation" .
> "FROM ccsd, log WHERE ccsd=log.logccsd");
> 
> while ($query = mysql_fetch_array($sqlquery1)) {
>  $CCSD = $query["CCSD"];
>  $Description = $query["Description"];
>  $Impact = $query["Impact"];
>  $Isolation = $query["Isolation"];
> }
> This code is not working.help please.yes I am a newbie!
> 
> 
> 
> -- 
> 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




RE: [PHP-DB] Relational database

2002-03-21 Thread Hunter, Ray

Try this:

SELECT ccsd.Description, ccsd.Impact, ccsd.Isolation FROM ccsd, log WHERE
ccsd.logccsd=log.logccsd;

You cannot specify a database is = to a row...


Thank you,

Ray Hunter
Firmware Engineer

ENTERASYS NETWORKS


-Original Message-
From: Ron [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, March 21, 2002 6:32 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Relational database


I am trying to get fields from 2 different tables that have the same field
name to pull the records from one table For example
mysql_connect($DBhost,$DBuser,$DBpass) or die("Unable toconnect to
database");
@mysql_select_db("$DBName") or die("Unable to select database $DBName");
$sqlquery1 = mysql_query("SELECT Description, Impact, Isolation" . "FROM
ccsd, log WHERE ccsd=log.logccsd");

while ($query = mysql_fetch_array($sqlquery1)) {
 $CCSD = $query["CCSD"];
 $Description = $query["Description"];
 $Impact = $query["Impact"];
 $Isolation = $query["Isolation"];
}
This code is not working.help please.yes I am a newbie!



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