Re: Re: problem with JOIN

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Sukalyan wrote:

> I want know how to fetch rows of a table from join sql statement.
> this code is return all rows but it repetating all rows three times.

I don't see any JOIN statement on SQL command below, do you asking for
the equal JOIN command for this SQL command?

try using DISTINCT on t1.name1 Ex. ... DISTINCT(t1.name1), ...

> <?php
> $db_connect = mysql_connect('localhost', 'root', '');
> $db_select = mysql_select_db('30k', $db_connect);
> $sql = "SELECT t1.name1, t2.dist2 FROM join1 t1, join2 t2 WHERE t1.nation = t2.nation";
> // I am trying to fetch result from table join1 & join2
> 
> $query = mysql_query($sql) or die(mysql_error());
> while($row = mysql_fetch_array($query, MYSQL_ASSOC))
> {
>    echo $row['name1'] . "<br>";
> }
> ?> 



-- 
Markus
------------------------------
RevTI Web Hosting
http://www.revti.com
------------------------------


------------------------ Yahoo! Groups Sponsor --------------------~--> 
Home is just a click away.  Make Yahoo! your home page now.
http://us.click.yahoo.com/DHchtC/3FxNAA/yQLSAA/saFolB/TM
--------------------------------------------------------------------~-> 

PHP Data object relational mapping generator
http://www.metastorage.net/ 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-objects/

<*> To unsubscribe from this group, send an email to:
    php-objects-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 





[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux