1.11M Members

mysql insertion doubt

 
0
 

Dear all,
The first query works while the second doesnt, am not able to figure, can u please help me out.

1) // $query3="insert into ttrough(am,pm) select ttam.subject,ttpm.subjectpm from ttam,ttpm where ttam.class != ttpm.classpm limit 1";// this one actually takes two columns from different tables and checks whether they are not similar(if i may be correct)

2) this encouraged me to try for 4 columns from 4 different table as i needed in my college project.
//$result7=mysql_query("INSERT INTO ttrough(am,am1,pm,pm1) SELECT ttam.subject,ttam1.subject,ttpm.subjectpm,ttpm1.subjectpm WHERE ttam.class!=ttam1.class!=ttpm.classpm!=ttpm1.classpm ");

where , ttrough,ttam,ttam1,ttpm,ttpm2 are different tables

 
0
 

This part is incorrect

ttam.class != ttam1.class!=ttpm.classpm!=ttpm1.classpm

You can't string them together like that. You need to separate them out as separate claues and use AND or OR to build up the logical expression.

ttam.class!=ttam1.class AND ttam1.class != ttpm.classpm AND ttpm.classpm != ttpm1.classpm
 
0
 

This part is incorrect

ttam.class != ttam1.class!=ttpm.classpm!=ttpm1.classpm

You can't string them together like that. You need to separate them out as separate claues and use AND or OR to build up the logical expression.

ttam.class!=ttam1.class AND ttam1.class != ttpm.classpm AND ttpm.classpm != ttpm1.classpm

its because of people like u that its more easier to learn:)
thank u:)

Question Answered as of 2 Years Ago by hericles
You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article