Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Aug 2002
Posts: 1,191
Kahuna
Kahuna
Joined: Aug 2002
Posts: 1,191
I know how to do this in MSSQL and it is killing me for not being able to find the solution yet.

I created a new table called "inchat". Two fields: C_Username, C_Last.

I also added a new field in the w3t_online table called "O_InChat" (VARCHAR(3) DEFAULT 'no').

I want to run a query that match the C_Username (from the inchat table) with the O_Username (from the w3t_online table) and update the O_InChat field (in the w3t_Online table) to 'yes' for the matched fields.

I came up with this - which doesn't work:
code:

UPDATE inchat
INNER JOIN w3t_online
ON inchat.C_Username = w3t_online.O_Username
SET w3t_online.O_InChat = "yes"


:wallbash: :wallbash:

I don't know what I'm doing wrong....

Thanks in advance

Warm regards

Nikos


Nikos
Sponsored Links
Joined: Apr 2002
Posts: 1,768
Addict
Addict
Offline
Joined: Apr 2002
Posts: 1,768
Hmmm ... I couldn't find any way to do that either, using only a MySQL query.

Of course, using PHP, you can first do a select query to get the usernames that match across the inchat and w3t_Online tables, and then do the update query on the w3t_Online table using the result from the first query. I could post some code if you want.

Maybe someone else knows a way to do this with a single query.

Last edited by Dave_L; 11/19/2002 2:24 PM.

Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
Posts: 70
Joined: January 2007
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)