hello everyone.. i'm a newby in mysql but i'm trying hard.
So i won't lose a minute, and i'll go straight into the heart of the problem.
I have the following mysql dumps:
DROP TABLE IF EXISTS location_tree;
CREATE TABLE location_tree (
id int(11) NOT NULL auto_increment,
pid int(11) NOT NULL default '0',
mid int(5) NOT NULL default '0',
user varchar(60) NOT NULL default '',
title_greek varchar(255) NOT NULL default '',
title_english varchar(255) NOT NULL default '',
tk int(5) NOT NULL default '0',
not_ok tinyint(1) NOT NULL default '1',
PRIMARY KEY (id)
) ENGINE=MyISAM;
INSERT INTO location_tree VALUES (1, 0, 0, '', '11111111', '11111111', 0, 0);
INSERT INTO location_tree VALUES (12, 1, 0, '', '222222', '222222', 35100, 0);
INSERT INTO location_tree VALUES (145, 12, 1, '', '333333', '333333', 35100, 0);
DROP TABLE IF EXISTS location_details;
CREATE TABLE location_details (
id int(11) NOT NULL auto_increment,
gid varchar(60) NOT NULL default '',
lid int(11) NOT NULL default '0',
cords varchar(60) NOT NULL default '',
title_greek varchar(255) NOT NULL default '',
title_english varchar(255) NOT NULL default '',
user varchar(60) NOT NULL default '',
not_ok tinyint(1) NOT NULL default '1',
PRIMARY KEY id (id)
) ENGINE=MyISAM;
INSERT INTO location_details VALUES (522, 'plateies', 145, '', '1111111a', '1111111a', '', 0);
INSERT INTO location_details VALUES (692, 'perioxes', 145, '', '22222a', '22222a', '', 0);
INSERT INTO location_details VALUES (30, 'dromosi', 145, '', '33333a', '33333a', '', 0);
DROP TABLE IF EXISTS cg_business;
CREATE TABLE cg_business (
id int(11) NOT NULL auto_increment,
cid int(11) NOT NULL default '0',
bustitle_greek varchar(255) NOT NULL default '',
bustitle_english varchar(255) NOT NULL default '',
address int(11) default NULL,
addressnum varchar(20) default NULL,
perioxi int(11) NOT NULL default '0',
location int(11) NOT NULL default '0',
PRIMARY KEY (id),
FULLTEXT KEY wholesite (bustitle_greek,bustitle_english)
) ENGINE=MyISAM;
INSERT INTO cg_business VALUES (1775,128,'jhgjhgjhg', 'jhgjhgjhg',522, '8', 0, 145);
INSERT INTO cg_business VALUES (496,128,'jhgjhgjhghh', 'jhgjhgjhghh',522, '8', 0, 145);
INSERT INTO cg_business VALUES (497,128,'jhgjhgjhghh', 'jhgjhgjhghh',522, '8', 0, 145);
INSERT INTO cg_business VALUES (498,128,'jhgjhgjhghh', 'jhgjhgjhghh',522, '8', 0, 145);
INSERT INTO cg_business VALUES (499,128,'jhgjhgjhghh', 'jhgjhgjhghh',522, '8', 692, 145);
INSERT INTO cg_business VALUES (500,128,'jhgjhgjhghh', 'jhgjhgjhghh',30, '8', 692, 145);
INSERT INTO cg_business VALUES (501,128,'jhgjhgjhghh', 'jhgjhgjhghh',30, '8', 692, 145);
INSERT INTO cg_business VALUES (502,128,'jhgjhgjhghh', 'jhgjhgjhghh',30, '8', 0, 145);
INSERT INTO cg_business VALUES (503,128,'jhgjhgjhghh', 'jhgjhgjhghh',30, '8', 692, 145);
And i want to make a query to get the data from all cg_business table, fields, and in this query result i want to have also the data from location_tree table, and location_details(i want twice the results from this table in the same query).
The problem is when i use the query which i will attach below, as u see it i have no errors but no records in result too, without the p. portions i get only one record in result, and without the a. portions i have all the records.
The query:
SELECT
id,
cid,
bustitle_greek,
address,
addressnum,
perioxi,
location,
a.cords as acords,
a.title_greek as addressname,
p.cords as pcords,
p.title_greek as perioxiname,
l.title_greek as locationname
FROM
cg_business,
location_details AS a,
location_details AS p,
location_tree AS l
WHERE
b.cid=128
AND address = a.id
AND perioxi = p.id
AND location = l.id
ORDER BY bustitle_greek ASC;
And the wanted resault as of the result fields (with the found records) is the following...
id | cid | bustitle_greek | address | addressnum | perioxi | location | locationname | acords | addressname | pcords | perioxiname | locationname
Any help will be very very wellcome....
thnx in advance for just reading this post!!!!