Welcome Guest, Not a member yet? Register   Sign In
SQL query
#1

[eluser]Unknown[/eluser]
I want to do this sql query

select table1.name, table1.address from table1 where table1.name = table2.name and table2.id = '12345';

I tried in my models with this syntax

$this->db->query("select.........");

but the result is error like this...

A Database Error Occurred

Error Number: 1064

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near where table1.name = table2.name...

Anybody please help me... to do that sql query Sad(.. for my final assigment this semester... I'm gonna die Sad(
#2

[eluser]web-johnny[/eluser]
[quote author="Nadia Orin" date="1307802040"]I want to do this sql query

select table1.name, table1.address from table1 where table1.name = table2.name and table2.id = '12345';

I tried in my models with this syntax

$this->db->query("select.........");

but the result is error like this...

A Database Error Occurred

Error Number: 1064

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near where table1.name = table2.name...

Anybody please help me... to do that sql query Sad(.. for my final assigment this semester... I'm gonna die Sad([/quote] Your query is wrong that's why . There is no such a table2!!!! perhaps you want to do a join. Read the active record it's quite easy.
#3

[eluser]Unknown[/eluser]
aha.... thanks thanks thanks... I've been "panic at the disco".. :cheese: ....

aaaaa thanks a lot... :cheese:

I'm still newbiew :red:
thanks thanks thanks ;D




Theme © iAndrew 2016 - Forum software by © MyBB