$save= mysql_query("update students set bid=(select bid from batches
where batches.start_date=students.start_date)");
I am using this... please help me.
$save= mysql_query("update students set bid=(select bid from batches
where batches.start_date=students.start_date)");
I am using this... please help me.
you could do this with a stored procedure - write a stored procedure with the update statements in a transaction. Or write your query like this.
EDITED:
UPDATE students s, anothertable a
SET s.bid = (select bid from batches
where batches.start_date=students.start_date),a.bid = (select bid from batches
where batches.start_date=students.start_date)
A better way of writing the above would be
UPDATE students s, anothertable a, batches b
SET s.bid = b.bid, a.bid = b.bid
where b.start_date=s.start_date;