0

Hi

I am new to MySQL and not too shure how can I update row form another table while cheking if logged in user is same:
`Telefonist='".$_SESSION["UserName"]."

And also I need to check if date is the same so It gets to right pearson on right date in a row:
log.Datum=telefonisti_podaci.Datum

here I am trying to count all 1ones and enter sum to from table1 to table2 in specific place.

Code:

$sql_zapis_do30 = "UPDATE telefonisti_podaci
SET `Total tura do 30` = (Select COUNT(*) `Ture do 30` from log,telefonisti_podaci WHERE `Ture do 30` is not null AND `Ture do 30`=1 AND log.Datum=telefonisti_podaci.Datum )
WHERE `Telefonist`='".$_SESSION["UserName"]."'";

CustomQuery($sql_zapis_do30);

I get error:
You can't specify target table 'telefonisti_podaci' for update in FROM clause

Thanks

2
Contributors
2
Replies
35
Views
2 Years
Discussion Span
Last Post by mehnihma
0

You can't specify target table 'telefonisti_podaci' for update in FROM claus

This looks like a non-default MySQL error. Maybe it's a custom error triggered by your CustomQuery function? If so, then you could check that function to see when and thus why it is thrown/given.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.