$sql_notice = "select * from $t_article art inner join $t_ar
来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/05/14 03:02:05
$sql_notice = "select * from $t_article art inner join $t_article_cat cat where art.cat_id=cat.cat_id and cat.cat_id='$ncat_id' and cat.is_show=1 and art.is_show=1 order by art.short_order desc limit 0,10";
这句代码哪里错了,为什么降序实现不了?
$sql_cat = "select * from $t_article_cat where is_show=1 and shop_id='$shop_id' order by sort_order asc limit 0,1";
$cat_notice = $dbo->getRs($sql_cat);
foreach($cat_notice as $value){
$ncat_id=$value['cat_id'];
$sql_notice = "select * from $t_article art inner join $t_article_cat cat where art.cat_id=cat.cat_id and cat.cat_id='$ncat_id' and cat.is_show=1 and art.is_show=1 order by art.short_order desc limit 0,10";
$notice = $dbo->getRs($sql_notice);
这句代码哪里错了,为什么降序实现不了?
$sql_cat = "select * from $t_article_cat where is_show=1 and shop_id='$shop_id' order by sort_order asc limit 0,1";
$cat_notice = $dbo->getRs($sql_cat);
foreach($cat_notice as $value){
$ncat_id=$value['cat_id'];
$sql_notice = "select * from $t_article art inner join $t_article_cat cat where art.cat_id=cat.cat_id and cat.cat_id='$ncat_id' and cat.is_show=1 and art.is_show=1 order by art.short_order desc limit 0,10";
$notice = $dbo->getRs($sql_notice);
你没有设置连接关系 on art.cat_id=cat.cat_id ,修改如下
$sql_notice = "select art.* ,cat.* from ".$t_article." art inner join ".$t_article_cat." cat on art.cat_id=cat.cat_id where cat.cat_id='".$ncat_id."' and cat.is_show=1 and art.is_show=1 order by art.short_order desc limit 0,10";
echo $sql_notice;
再问: 还是没有变。。
再答: 你把 echo $sql_notice 的 sql在 查询分析器中 执行 看看 就知道了, 语句中 是 按照short_order 字段的降序排列的
$sql_notice = "select art.* ,cat.* from ".$t_article." art inner join ".$t_article_cat." cat on art.cat_id=cat.cat_id where cat.cat_id='".$ncat_id."' and cat.is_show=1 and art.is_show=1 order by art.short_order desc limit 0,10";
echo $sql_notice;
再问: 还是没有变。。
再答: 你把 echo $sql_notice 的 sql在 查询分析器中 执行 看看 就知道了, 语句中 是 按照short_order 字段的降序排列的
$sql_notice = "select * from $t_article art inner join $t_ar
select * from tab_a inner join tab_b on tab_a.col1 = tab_b.c
select * from a,b与select * from a inner join b 的取数方式和执行效率有什么
select s.name,s.course,s.grade from student as s inner join
select * from userinfo a inner join emp b on a.userinfoid li
select ···fromA join B on·····和select····from A inner join B
if not exists (SELECT * From TA_ARTIFICER Where ARTID = @Art
sql="select P.*,T.name as Typename from tb_function P inner
inner join 与 =区别
sql select 语句加inner join的一些比较复杂的问题
ql select 语句加inner join的一些比较复杂的问题
$sql = "select tb_note.*,answ.* from tb_note left join";这句话解