最好在语言代码中判断,再运行不同的SQL语句select p.id from products p,pd.description from products_description pd on(p.id=pd.id) where pd.language_id in (1,8) and p.id=125;
解决方案 »
- 不能上到mysql服务器上连接localhost
- MySQL存储过程_删除时更新另一张表计数?
- mysql 里怎样查找含有"_"的,like '%_%'不行啊!
- 为什么下面这个存储过程在mysql中运行后,会出现如下错误提示?怎样解决?
- 谈谈SUN被Oracle收购后 My SQL的出路何在呢?
- 一条SQL查询语句,怎么对比两个时间得到今天发布的记录!
- 被难倒了,中文系统如何导入导出包含韩文的mysql数据库?
- mysql的视图能传参数吗
- 求一MYSQL触发器代码----自动生成ID-----急
- 怎样获得数据库最近一次更新的时间
- 求推荐 MySQL SQL 编程 方面的书籍
- 这个表怎么查询,请大家指点下
select .... from (
select *,(select count(*) from products_description where language_id=8) as ss, from products_description .....
)
where language_id in (iif(ss=0,1,8))
select p.id, pd.description, 1 rank from products p inner join products_description pd
on(p.id=pd.id) where pd.language_id =8 and p.id=125
union
select p.id, pd.description, 2 rank from products p inner join products_description pd
on(p.id=pd.id) where pd.language_id =1 and p.id=125 ) tmp order by rank limit 1;
要么修改SQL语句