|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
You don't need a fax machine to get faxes. Get a fax-to-email fax number from CallWave. Try it free.
|
|
#1
|
|||
|
|||
|
Error in Syntax insert with sub-select
I can't find the error ...
MySql: 3.23 "insert into post values('',(select count(*) from subject), '$message');" Thanks for the help! |
|
#2
|
|||
|
|||
|
Hi,
Count() is an aggregate function and you're trying to use it as a sub-query, which just isnt possible with MySQL. You'll have to spilt your query into two, and add the results of the first into the second as a variable: $res = mysql_query(select count(*) from subject) $row = mysql_fetch_row($res); $numRows = $row[0]; insert into post values('',$numRows, '$message') |
|
#3
|
|||
|
|||
|
Yah, unfortunately MySQL doesnt support sub queries, although i've heard that future versions will.
__________________
i am cope. i drink coke. i am in hope.i am cope. i drink coke. i am in hope.i am cope. i drink coke. i am in hope. |
|
#4
|
|||
|
|||
|
I thought i have to do it in two queries ...
Thanks for you Help |
![]() |
| Viewing: Dev Articles Community Forums > Databases > General SQL Development > Error in Syntax insert with sub-select |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|