MLUG: [MLUG] mysql problem
[MLUG] mysql problem
Email address obfuscation in effect -- please click here to turn it off.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
hi
i am inserting values from table "marksquery" to table "chemistry"
in descendig order by the query m_marks and select only values of subjects = 
"CHM" by the query

mysql_query("INSERT INTO chemistry 
(f_name,l_name,m_marks,province,subjects,id) select 
markstable.f_name,l_name,m_marks,
province,subjects,id from markstable where subjects = 'CHM' order by m_marks 
ASC");

this query is working well but i want to insert only 10 rows from table 
"marksquery" to table "chemistry" i defined check for this and also defined 
loop as
for($i=1; $i<=10; $i++)
{
mysql_query("INSERT INTO 
chemistry(f_name,l_name,m_marks,province,subjects,id) select 
markstable.f_name,l_name,m_marks,
province,subjects,id from markstable where subjects = 'CHM' order by m_marks 
ASC");

but this not works and it insert all the rows of subjects ="CHM" from table 
"marksquery" to table "chemistry"
I want to insert only First 10 rows.Any one can help me
regards

_________________________________________________________________
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*. 
http://join.msn.com/?page=features/virus

_______________________________________________
members mailing list
EMAIL:PROTECTED
http://mlug.missouri.edu/mailman/listinfo/members