Hej,
Jag förstår inte varför dessa två frågor ger olika resultat. Någon som kan förklara?
SELECT a.* , c.name AS county_name, i.name AS industry_name, m.name AS municipality_name
FROM ads a
LEFT JOIN counties c ON a.county_id = c.id
LEFT JOIN industries i ON a.industry_id = i.id
LEFT JOIN municipalities m ON a.municipality_id = m.id
WHERE date_expires >1163411367
AND visible = 'Y'
AND confirmed = 'Y'
AND type_id = '2'
ORDER BY date_confirmed DESC , date_created DESC
LIMIT 3
SELECT a.id , c.name AS county_name, i.name AS industry_name, m.name AS municipality_name
FROM ads a
LEFT JOIN counties c ON a.county_id = c.id
LEFT JOIN industries i ON a.industry_id = i.id
LEFT JOIN municipalities m ON a.municipality_id = m.id
WHERE date_expires >1163411367
AND visible = 'Y'
AND confirmed = 'Y'
AND type_id = '2'
ORDER BY date_confirmed DESC , date_created DESC
LIMIT 3
Jag förstår inte riktigt hur det hänger ihop. Någon som kan förklara för mig snälla?
Vh ivar
ps .Så här ser ads ut
CREATE TABLE `ads` (
`id` int(11) NOT NULL auto_increment,
`type_id` tinyint(2) default NULL,
`owner_id` smallint(5) NOT NULL default '0',
`confirmed` enum('Y','N') NOT NULL default 'N',
`visible` enum('Y','N') NOT NULL default 'Y',
`header` varchar(100) NOT NULL default '',
`description` text NOT NULL,
`date_created` int(11) NOT NULL default '0',
`date_expires` int(11) NOT NULL default '0',
`date_modified` int(11) NOT NULL default '0',
`date_confirmed` int(11) NOT NULL default '0',
`industry_id` smallint(3) NOT NULL default '0',
`county_id` smallint(3) NOT NULL default '0',
`municipality_id` smallint(3) NOT NULL default '0',
`result` enum('+','-','?') NOT NULL default '?',
`turnover_min` int(6) NOT NULL default '0',
`turnover_max` int(6) NOT NULL default '0',
`num_views` int(6) NOT NULL default '0',
`num_contacts` smallint(5) NOT NULL default '0',
`comment` text NOT NULL,
`num_employees_min` int(5) NOT NULL default '0',
`num_employees_max` int(5) NOT NULL default '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ;