出错的sql语句是SELECT s.id AS id, s.name AS appname, s.innerID AS appid, t.des AS types1, r.title AS t_star_title
FROM soft_base s, soft_type t
LEFT JOIN t_star r ON s.t_star_k = r.id
WHERE s.type = '0'
AND s.type_id = t.id
表结构
CREATE TABLE IF NOT EXISTS `soft_base` (
`id` int(10) unsigned NOT NULL auto_increment,
`name` varchar(255) NOT NULL,
`type_id` int(10) unsigned NOT NULL,
`type` int(10) unsigned NOT NULL,
`innerID` int(10) unsigned NOT NULL,
`despic` varchar(255) default NULL,
`cpid` int(10) unsigned NOT NULL,
`apcode` varchar(32) NOT NULL,
`iffree` tinyint(4) NOT NULL default '0',
`intro_size` text character set utf8 collate utf8_unicode_ci NOT NULL,
`intro_fee` text character set utf8 collate utf8_unicode_ci NOT NULL,
`intro_cp` text character set utf8 collate utf8_unicode_ci NOT NULL,
`intro_content` text character set utf8 collate utf8_unicode_ci NOT NULL,
`intro_define` text character set utf8 collate utf8_unicode_ci NOT NULL,
`if_pass` tinyint(3) unsigned NOT NULL default '0',
`upload_user_id` int(10) unsigned NOT NULL default '0',
`icon` varchar(255) character set utf8 collate utf8_unicode_ci NOT NULL,
`download` int(10) unsigned NOT NULL,
`t_star_k` int(10) unsigned default '0',
`t_test` int(10) unsigned default '0',
`t_source` int(10) unsigned default '0',
`t_net` int(10) unsigned default '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=gb2312 AUTO_INCREMENT=642 ;
CREATE TABLE IF NOT EXISTS `soft_type` (
`id` int(10) unsigned NOT NULL auto_increment,
`des` varchar(255) NOT NULL,
`idx` varchar(16) default NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=gb2312 AUTO_INCREMENT=58 ;
CREATE TABLE IF NOT EXISTS `t_star` (
`id` int(10) unsigned NOT NULL auto_increment,
`title` varchar(64) collate utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=7 ;
以下是数据-- phpMyAdmin SQL Dump
-- version 2.11.2
-- http://www.phpmyadmin.net
--
-- 主机: localhost
-- 生成日期: 2011 年 05 月 30 日 06:29
-- 服务器版本: 5.0.45
-- PHP 版本: 5.2.5SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";--
-- 数据库: `fujian`
----
-- 导出表中的数据 `soft_base`
--INSERT INTO `soft_base` (`id`, `name`, `type_id`, `type`, `innerID`, `despic`, `cpid`, `apcode`, `iffree`, `intro_size`, `intro_fee`, `intro_cp`, `intro_content`, `intro_define`, `if_pass`, `upload_user_id`, `icon`, `download`, `t_star_k`, `t_test`, `t_source`, `t_net`) VALUES
(618, '爱游戏', 0, 0, 463, NULL, 0, '', 0, '', '', '', '', '', 1, 0, '', 0, 0, 0, 0, 0),
(619, '育儿经', 0, 0, 464, NULL, 0, '', 0, '', '', '', '', '', 1, 0, '', 0, 0, 0, 0, 0),
(620, '掌上百度', 0, 0, 465, NULL, 0, '', 0, '', '', '', '', '', 1, 0, '', 0, 0, 0, 0, 0),
(621, 'JBench2', 0, 0, 466, NULL, 0, '', 0, '', '', '', '', '', 1, 0, '', 0, 0, 0, 0, 0),
(622, '爱逛', 0, 0, 467, NULL, 0, '', 0, '', '', '', '', '', 1, 0, '', 0, 0, 0, 0, 0),
(623, '体坛周报', 0, 0, 468, NULL, 0, '', 0, '', '', '', '', '', 1, 0, '', 0, 0, 0, 0, 0),
(624, '金山词霸', 0, 0, 469, NULL, 0, '', 0, '', '', '', '', '', 1, 0, '', 0, 0, 0, 0, 0),
(625, '人人2010', 0, 0, 470, NULL, 0, '', 0, '', '', '', '', '', 1, 0, '', 0, 0, 0, 0, 0),
(626, '手机理财', 0, 0, 471, NULL, 0, '', 0, '', '', '', '', '', 1, 0, '', 0, 0, 0, 0, 0),
(627, '测试类型', 0, 0, 472, NULL, 0, '', 0, '', '', '', '', '', 1, 0, '', 0, 0, 0, 0, 0),
(638, '非法所得', 35, 0, 473, '52/34/638_p.JPG', 1, '', 0, '', '', '', '', '', 1, 0, '52/34/638_i.gif', 0, 0, 0, 0, 0),
(639, '代收费', 35, 0, 474, '18/65/639_p.JPG', 1, '', 0, '', '', '', '', '', 1, 0, '18/65/639_i.gif', 0, 0, 0, 0, 0),
(640, '图表测试', 35, 0, 475, '75/51/640_p.gif', 1, '', 0, '', '', '', '', '', 1, 0, '75/51/640_i.gif', 0, 0, 0, 0, 0),
(641, '代收费', 0, 0, 476, '27/43/641_p.JPG', 0, '', 0, '', '', '', '', '', 1, 0, '27/43/641_i.gif', 0, 0, 0, 0, 0);--
-- 导出表中的数据 `soft_type`
--INSERT INTO `soft_type` (`id`, `des`, `idx`) VALUES
(18, '其他', '0502'),
(30, 'test', '0501'),
(35, '其他类型', '05'),
(37, '浙江电信测试', '06'),
(38, '新分类', '07'),
(39, '奥软', '08'),
(48, '999测试软件', '09'),
(49, 'IAVA免费软件', '10'),
(50, '四川测试', '11'),
(51, '游戏基地', '12'),
(52, 'Android测试', '13'),
(53, '奥软大LAV', '14'),
(54, 'android华为校园机', '15'),
(55, '娄英奎临时', '16'),
(56, 'test', '17'),
(57, 'tt1', '10');--
-- 导出表中的数据 `t_star`
--INSERT INTO `t_star` (`id`, `title`) VALUES
(1, '*'),
(2, '**'),
(3, '***'),
(4, '****'),
(5, '*****');
FROM soft_base s, soft_type t
LEFT JOIN t_star r ON s.t_star_k = r.id
WHERE s.type = '0'
AND s.type_id = t.id
表结构
CREATE TABLE IF NOT EXISTS `soft_base` (
`id` int(10) unsigned NOT NULL auto_increment,
`name` varchar(255) NOT NULL,
`type_id` int(10) unsigned NOT NULL,
`type` int(10) unsigned NOT NULL,
`innerID` int(10) unsigned NOT NULL,
`despic` varchar(255) default NULL,
`cpid` int(10) unsigned NOT NULL,
`apcode` varchar(32) NOT NULL,
`iffree` tinyint(4) NOT NULL default '0',
`intro_size` text character set utf8 collate utf8_unicode_ci NOT NULL,
`intro_fee` text character set utf8 collate utf8_unicode_ci NOT NULL,
`intro_cp` text character set utf8 collate utf8_unicode_ci NOT NULL,
`intro_content` text character set utf8 collate utf8_unicode_ci NOT NULL,
`intro_define` text character set utf8 collate utf8_unicode_ci NOT NULL,
`if_pass` tinyint(3) unsigned NOT NULL default '0',
`upload_user_id` int(10) unsigned NOT NULL default '0',
`icon` varchar(255) character set utf8 collate utf8_unicode_ci NOT NULL,
`download` int(10) unsigned NOT NULL,
`t_star_k` int(10) unsigned default '0',
`t_test` int(10) unsigned default '0',
`t_source` int(10) unsigned default '0',
`t_net` int(10) unsigned default '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=gb2312 AUTO_INCREMENT=642 ;
CREATE TABLE IF NOT EXISTS `soft_type` (
`id` int(10) unsigned NOT NULL auto_increment,
`des` varchar(255) NOT NULL,
`idx` varchar(16) default NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=gb2312 AUTO_INCREMENT=58 ;
CREATE TABLE IF NOT EXISTS `t_star` (
`id` int(10) unsigned NOT NULL auto_increment,
`title` varchar(64) collate utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=7 ;
以下是数据-- phpMyAdmin SQL Dump
-- version 2.11.2
-- http://www.phpmyadmin.net
--
-- 主机: localhost
-- 生成日期: 2011 年 05 月 30 日 06:29
-- 服务器版本: 5.0.45
-- PHP 版本: 5.2.5SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";--
-- 数据库: `fujian`
----
-- 导出表中的数据 `soft_base`
--INSERT INTO `soft_base` (`id`, `name`, `type_id`, `type`, `innerID`, `despic`, `cpid`, `apcode`, `iffree`, `intro_size`, `intro_fee`, `intro_cp`, `intro_content`, `intro_define`, `if_pass`, `upload_user_id`, `icon`, `download`, `t_star_k`, `t_test`, `t_source`, `t_net`) VALUES
(618, '爱游戏', 0, 0, 463, NULL, 0, '', 0, '', '', '', '', '', 1, 0, '', 0, 0, 0, 0, 0),
(619, '育儿经', 0, 0, 464, NULL, 0, '', 0, '', '', '', '', '', 1, 0, '', 0, 0, 0, 0, 0),
(620, '掌上百度', 0, 0, 465, NULL, 0, '', 0, '', '', '', '', '', 1, 0, '', 0, 0, 0, 0, 0),
(621, 'JBench2', 0, 0, 466, NULL, 0, '', 0, '', '', '', '', '', 1, 0, '', 0, 0, 0, 0, 0),
(622, '爱逛', 0, 0, 467, NULL, 0, '', 0, '', '', '', '', '', 1, 0, '', 0, 0, 0, 0, 0),
(623, '体坛周报', 0, 0, 468, NULL, 0, '', 0, '', '', '', '', '', 1, 0, '', 0, 0, 0, 0, 0),
(624, '金山词霸', 0, 0, 469, NULL, 0, '', 0, '', '', '', '', '', 1, 0, '', 0, 0, 0, 0, 0),
(625, '人人2010', 0, 0, 470, NULL, 0, '', 0, '', '', '', '', '', 1, 0, '', 0, 0, 0, 0, 0),
(626, '手机理财', 0, 0, 471, NULL, 0, '', 0, '', '', '', '', '', 1, 0, '', 0, 0, 0, 0, 0),
(627, '测试类型', 0, 0, 472, NULL, 0, '', 0, '', '', '', '', '', 1, 0, '', 0, 0, 0, 0, 0),
(638, '非法所得', 35, 0, 473, '52/34/638_p.JPG', 1, '', 0, '', '', '', '', '', 1, 0, '52/34/638_i.gif', 0, 0, 0, 0, 0),
(639, '代收费', 35, 0, 474, '18/65/639_p.JPG', 1, '', 0, '', '', '', '', '', 1, 0, '18/65/639_i.gif', 0, 0, 0, 0, 0),
(640, '图表测试', 35, 0, 475, '75/51/640_p.gif', 1, '', 0, '', '', '', '', '', 1, 0, '75/51/640_i.gif', 0, 0, 0, 0, 0),
(641, '代收费', 0, 0, 476, '27/43/641_p.JPG', 0, '', 0, '', '', '', '', '', 1, 0, '27/43/641_i.gif', 0, 0, 0, 0, 0);--
-- 导出表中的数据 `soft_type`
--INSERT INTO `soft_type` (`id`, `des`, `idx`) VALUES
(18, '其他', '0502'),
(30, 'test', '0501'),
(35, '其他类型', '05'),
(37, '浙江电信测试', '06'),
(38, '新分类', '07'),
(39, '奥软', '08'),
(48, '999测试软件', '09'),
(49, 'IAVA免费软件', '10'),
(50, '四川测试', '11'),
(51, '游戏基地', '12'),
(52, 'Android测试', '13'),
(53, '奥软大LAV', '14'),
(54, 'android华为校园机', '15'),
(55, '娄英奎临时', '16'),
(56, 'test', '17'),
(57, 'tt1', '10');--
-- 导出表中的数据 `t_star`
--INSERT INTO `t_star` (`id`, `title`) VALUES
(1, '*'),
(2, '**'),
(3, '***'),
(4, '****'),
(5, '*****');
解决方案 »
- 分组取前N记录
- cannot creat windows service for mysql.Error:0
- 请教:嵌入式系统安装MySQL数据库的问题
- PgManager连接postgresql 提示: cannot load dynamic library libpq.dll
- 换成mysql5、phpMyAdmin 2.6.0-pl3,没有做任何修改,用php、在命令行里读写数据都没有乱码问题,倒是在phpMyAdmin里显示的中文数据都是
- c api中mysql_query语句会堵塞么?
- 创建存储过程时“CONTAINS SQL”选项的问题
- 如何在vc中配置mysql++环境?多谢!!
- 动态字段查询问题
- MYSQL在命令提示框里中文不能正常显示,换台电脑就可以,怎解
- 数据库字段太多会怎么样?????????
- 网站的用户Id比如"237060385"这个数是怎么生成的?
FROM soft_base s INNER JOIN soft_type t
ON s.type_id = t.id
LEFT JOIN t_star r ON s.t_star_k = r.id
WHERE s.TYPE = '0'
-> FROM (soft_base s, soft_type t)
-> LEFT JOIN t_star r ON s.t_star_k = r.id
-> WHERE s.type = '0'
-> AND s.type_id = t.id;
+-----+----------+-------+----------+--------------+
| id | appname | appid | types1 | t_star_title |
+-----+----------+-------+----------+--------------+
| 638 | 非法所得 | 473 | 其他类型 | NULL |
| 639 | 代收费 | 474 | 其他类型 | NULL |
| 640 | 图表测试 | 475 | 其他类型 | NULL |
+-----+----------+-------+----------+--------------+
3 rows in set (0.08 sec)mysql>