GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Need help with Left Join (MySQL) (https://gfy.com/showthread.php?t=1086084)

MichaelP 10-20-2012 08:12 AM

Need help with Left Join (MySQL)
 
Hey guys, I'm doing a bit of clean up in my stuff and I,m bulilding a new tool to manage my banners...

Here is what I try to accomplish (I know it's easy for a real programmer, which I'm not and never pretended to be)

Table programs : id , name ( ex : 22 , BabesMoney) ... +++

Table banner : id , program_id , site, (ex : 1 , 22 , Babes.Com) ... +++

Now here is the query which I play with... Not working but I know I'm close.. The query itself is pretty self explanatory

Code:


$query = "SELECT banner.*, programs.* FROM banner LEFT JOIN programs ON (program_id = programs.id, program = programs.program,) WHERE  blah, blah blah, meh meh meh... ";

So on the print, I want Program = BabesMoney instead of just 22

Thank in advance

Vapid - BANNED FOR LIFE 10-20-2012 08:14 AM

databases are matrices.

MichaelP 10-20-2012 08:55 AM

Quote:

Originally Posted by pornopete (Post 19263738)
You're probably better off hiring somebody than spending your time on this.

Well I'd do this if I couldn't do any of it, but now I'm stuck on a simple query, so I won't hire a programmer for a single line of code ... :thumbsup

donborno 10-20-2012 08:58 AM

SELECT banner.id, programs.name, banner.site
FROM banner
LEFT JOIN programs ON banner.program_id = programs.id
WHERE blah, blah blah, meh meh meh...

Probably it's an INNER JOIN unless you have banners which do not reference a program

MichaelP 10-20-2012 09:30 AM

Quote:

Originally Posted by donborno (Post 19263814)
SELECT banner.id, programs.name, banner.site
FROM banner
LEFT JOIN programs ON banner.program_id = programs.id
WHERE blah, blah blah, meh meh meh...

Probably it's an INNER JOIN unless you have banners which do not reference a program

Not quite but Txs.

hey May I hire you for an hour or so? I can pay Paypal... I have a good name here and I want to keep it. Hit me up on ICQ pls @ 139036653 :thumbsup

woj 10-20-2012 10:03 AM

Quote:

Originally Posted by MichaelP (Post 19263857)
Not quite but Txs.

hey May I hire you for an hour or so? I can pay Paypal... I have a good name here and I want to keep it. Hit me up on ICQ pls @ 139036653 :thumbsup

If the other guy is busy, icq me: 33375924, I can help out..

sarettah 10-20-2012 10:05 AM

$query = "SELECT banner.*, programs.* FROM banner LEFT JOIN programs ON (program_id = programs.id, program = programs.program,)

Do you actually have that comma before the close paren in there. Because that will screw it for you.

.

MichaelP 10-20-2012 01:51 PM

Quote:

Originally Posted by woj (Post 19263910)
If the other guy is busy, icq me: 33375924, I can help out..

Thank you Woj for the nice help :)

Was very fast and effective. Will take yu for work again for sure.

A+ :thumbsup

sarettah 10-20-2012 03:03 PM

Quote:

Originally Posted by MichaelP (Post 19264195)
Thank you Woj for the nice help :)

Was very fast and effective. Will take yu for work again for sure.

A+ :thumbsup

Can't go wrong with WOJ :thumbsup

.

Bad18yroldvirginteens 10-20-2012 05:29 PM

man complicated

Lace 10-20-2012 09:50 PM

Quote:

Originally Posted by sarettah (Post 19264304)
Can't go wrong with WOJ :thumbsup

.

I've had friends hire WOJ before and he's always been great! :thumbsup

Kiopa_Matt 10-20-2012 10:23 PM

Code:

SELECT banner.id AS banner_id, banner.program_id AS program_id, programs.site AS site_name FROM banner, programs WHERE banner.program_id = programs.id;
You have three columns returned -- banner_id, program_id, site_name.

seeme 10-21-2012 01:30 AM

Quote:

Originally Posted by Kiopa_Matt (Post 19264741)
Code:

SELECT banner.id AS banner_id, banner.program_id AS program_id, programs.site AS site_name FROM banner, programs WHERE banner.program_id = programs.id;
You have three columns returned -- banner_id, program_id, site_name.

:thumbsup:thumbsup:thumbsup


All times are GMT -7. The time now is 01:34 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc