Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

select question

Status
Not open for further replies.

riffy

Programmer
Mar 29, 2001
106
US
hi,

this is my first time posting to this forum...i tried a keyword search but apparently the search is down...
my question is that in my database there are two tables called halogenproduct and cflproduct..

now on the index page for the site, there is a drop down box which lists the total number of distinct watts in both tables...

my question is how do i get the distinct watts from the halogenproduct table AND the distinct watts from the cflproduct table keeping in mind that the wattages should not overlap...

my query in php is...
Code:
<select>
<option value=&quot;&quot; selected>--Select--</option>
<?
$sql= &quot;select distinct halogenproduct.watts, cflproduct.watts from halogenproduct, cflproduct where halogenproduct.watts <> cflproduct.watts&quot;;
$result = mysql_query ($sql);
while ($row = mysql_fetch_array($result)) {
 extract($row);
?>
<option value=&quot;<? print $watts; ?>&quot;><? print $watts; ?></option>
<?
}
?>
</select>

i tried using the union operator like there is in sql but to no avail...

can someone please help me out?

thanks alot,
arif
X-) s-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top