Jump to content

PHP CALL 2 TABLES FROM ONE QUERY PLEASE HELP!


l!m!t

Recommended Posts

Hello, Hopefully someone can help me I have been at this for hours. I am trying to call two tables in one mysql query.

(see below )

$limit1 = "update " . CUSTOMERS . " set member_level = '10' [b]where orders_status_id =7 ";[/b]

order_status is located in a table called [b]ORDERS [/b]I cant figure out how to get that in the query. I have tried a Join command and still wont work. Everything else seems to work in basically just cant find "order_status", which is located in a table called ORDERS.

Any help would be very much appreocated!
Hi thanks for the reply.

Order is actually a seperate table

(eg The formatting is probably not right, but is what I am trying to do.

[code]$limit1 = "update " . CUSTOMERS . " set member_level = '10'  where " . TABLE_ORDERS . "  orders_status_id =7 ";[/code]

I want it to only update where the order_status_id =7 , the only thing I cant figure out is how to query the ORDERS table in the same call.
Can you explain again?
You want to set member_level in CUSTOMERS table to 10 if that member has order_status_id set to 7 in the table called TABLE_ORDERS?

I [i]think[/i] this how it's done, but I really not sure-
"UPDATE ".CUSTOMERS." SET member_level = '10' WHERE member IN (SELECT member FROM ".TABLE_ORDERS." WHERE orders_status_id = '7')"

Like I said, I am not sure.

Orio.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.