Page 1 of 1

correct mysql syntax

Posted: Wed Sep 28, 2005 5:27 am
by phpForX
Hi there,

my issue:

Given this:

Code: Select all

UPDATE wt_licences SET
customer_id ='".$GLOBALS["webuser"]["id"]."', 
domains =$amounttracker WHERE
strLogin='".addslashes($GLOBALS["webuser"]["strLogin"])."'"  ;
An update should be conducted on wt_licences with 2 data sets.

It's about the WHERE clause:

The field 'strLogin' is in another table (tblWebuser)
How can I get this working- with join?

Thanks
Jan

Posted: Wed Sep 28, 2005 5:52 am
by ruchit
you can't use a join in an update statement.. however, you can make use of a sub query

Posted: Wed Sep 28, 2005 6:05 am
by Jenk
You'll need to ensure you have the latest version of MySQL if you wish to use a sub/nested query as earlier version do not support them (I forget which versions)

Posted: Wed Sep 28, 2005 6:33 am
by phpForX
Thank you very much.

I'll try to find a better solution

Jan