Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 09-19-2016, 03:38 PM   #1
MKA
Hey...
 
MKA's Avatar
 
Industry Role:
Join Date: Nov 2011
Location: NL
Posts: 548
A tiny mysql question

It's late and my brain simply stopped working. I want to sleep but need to finish this so who helps me going to bed....


I need a rather simple command to perform with MYSQL.
Its looks simple.

I have 2 tables in the same database.
table 1 is named= A
table 2 is named= B

In table 1 we have a column called "views"
In table 2 we have a column called "enabled"

Basically. If enabled = 0 then views should be updated to 0

I tried something like this
UPDATE content_views
SET views = 0 ,
WHERE CONTENT.ENABLED = 0

which obviously did not worked.
MKA is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-19-2016, 05:32 PM   #2
myleene
Confirmed User
 
Industry Role:
Join Date: Oct 2013
Location: Canada
Posts: 869
You're missing the "INNER JOIN" and the "ON":
MySQL - Join and Update Values From Another Table
myleene is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-20-2016, 01:58 AM   #3
nightslit
Confirmed User
 
Industry Role:
Join Date: Oct 2013
Location: France
Posts: 226
UPDATE content_views
SET views = 0
WHERE CONTENT.ENABLED = 0
LEFT JOIN content ON content_views.shared_column_name = content.shared_column_name

Something like this
__________________
email: [email protected] email me for link trades/hardlink exchanges
ICQ : 665974711
my sites: http://hardcoreteenfuck.com
nightslit is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-20-2016, 03:11 AM   #4
MKA
Hey...
 
MKA's Avatar
 
Industry Role:
Join Date: Nov 2011
Location: NL
Posts: 548
Eventually, this did the trick..

UPDATE A AS t1
INNER JOIN B AS t2
ON t1.content = t2.record_num
SET t1.views = 0
WHERE t2.enabled = 0;

It needed an extra value that was similar in both databases to get this working. (A.content=B.record_num)
MKA is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks

Tags
table, views, enabled, simple, named=, mysql, called, column, basically, updated, content.enabled, set, content_views, update, tables, stopped, sleep, simply, brain, question, tiny, late, finish, perform, command



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.