Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,194,722 members, 7,955,710 topics. Date: Sunday, 22 September 2024 at 01:31 PM |
Nairaland Forum / Science/Technology / Webmasters / Help Mysql Problem (628 Views)
Please Help!!! Mysql 5.6 Not Running On My Pc. / Php/mysql Pin And Serial Number Generation Script / Wamp Server Ebook Ft Install Wamp, Write Php / Mysql / Mysql Console (2) (3) (4)
Help Mysql Problem by Nobody: 9:36am On Jul 03, 2011 |
I have this code for single connection $query = "SELECT b.*, u.nick, u.rate_sum FROM " . $DBPrefix . "bids b LEFT JOIN " . $DBPrefix . "users u ON (u.id = b.bidder) WHERE b.auction = " . $id . " ORDER BY b.bid DESC, b.quantity DESC, b.id DESC"; $result_numbids = mysql_query($query); $system->check_mysql($result_numbids, $query, __LINE__, __FILE__); but i want to make it 2 tables et 2nd table name is users_buyers how do i add it |
Re: Help Mysql Problem by Nobody: 10:05am On Jul 03, 2011 |
si 'et' en francais es siempre como 'and' en ingles then. . . Are you trying to use left join for two tables or what? or you want to split el data into dos mesas (tables)? |
Re: Help Mysql Problem by Nobody: 11:55am On Jul 03, 2011 |
Left inner right anything that will display the other result without problems tiens |
Re: Help Mysql Problem by Nobody: 12:08pm On Jul 03, 2011 |
Caramba! Maybe if you post a sample of the DDL and possible some Insertions someone might be able to help you do the join properly. Joining is one serious headache i run away from except i am teaching in a class or oracle or mysql. The easiest join is still the cartesian join, the inner joins are headaches sometimes. |
Re: Help Mysql Problem by Nobody: 2:29pm On Jul 03, 2011 |
$query = "SELECT b.*, u.nick, u.rate_sum FROM " . $DBPrefix . "bids b LEFT JOIN " . $DBPrefix . "users u ON (u.id = b.bidder) WHERE b.auction = " . $id . " ORDER BY b.bid DESC, b.quantity DESC, b.id DESC"; $result_numbids = mysql_query($query); $system->check_mysql($result_numbids, $query, __LINE__, __FILE__); $num_bids = mysql_num_rows($result_numbids); $i = 0; $left = $auction_data['quantity']; $hbidder_data = array(); while ($bidrec = mysql_fetch_assoc($result_numbids)) { if (!isset($bidderarray[$bidrec['nick']])) { if ($system->SETTINGS['buyerprivacy'] == 'y' && $user->user_data['id'] != $auction_data['user'] && $user->user_data['id'] != $bidrec['bidder']) { $bidderarray[$bidrec['nick']] = $MSG['176'] . ' ' . $bidderarraynum; $bidderarraynum++; } else { $bidderarray[$bidrec['nick']] = $bidrec['nick']; } } if ($left > 0 && !in_array($bidrec['bidder'], $hbidder_data)) iwont to add another table usersbuyers |
Re: Help Mysql Problem by Nobody: 3:13pm On Jul 03, 2011 |
Mehn, this your question is not clear to me at all. My suggestion, take a little time out and learn how to join in mysql, it is not as hard as it is. First, learn the different types of joins so that you will know which one will be the best and learn examples, then apply it to what you are trying to do. Hasta la vista. . . . |
(1) (Reply)
Connect Two Tables / Dear Nairalanders / Please Web Master Coment On This Site Julicollections.com
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 11 |