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

Recommended Answers

All 2 Replies

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

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:)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.