当前位置:首页
开发技术指南» 文章正文
    引言:
 

 

    摘要: 从网上下了一个javascript的日历控件 日历控件的click事件是这样定义的 function dayclick(n){ //点击显示框选取日期 var aaa,bbb; var t1=theyear;var t2=themonth; if (t2<10){t2="0"+t2;} if (n<10){n="0"+n;} if (n!......
 ·框架如何进行变量的传递    »显示摘要«
    摘要: 一个左右框架,名为main 由另一页传值 <a href="main?id=<%rs.fields("id")%>"><%rs.fields("name")%></a> 只能传到main这页上。 框架上有两页left,right 我想让它传到right这页上。我该怎么做? ......


求一条SELECT语句,高手请进。

现在有一个主表a,   两个子表b、c   ,父表a一条记录,在子表b中有多条记录。  
   
  现在要在一行中,列出父表a一记录,子表b和c对应的多条记录。  
   
  有没有办法实现,一行多条记录?

NO.1   作者: tsj68

可利用函数实现.

NO.2   作者: LGQDUCKY

既然是主从表,那就应该有个字段关联。比如:序号  
  select   a.*,b.*,c.*   from   a   a,b   b   ,c   c  
      where   a.no   =   b.no   and   a.no   =   c.no;

NO.3   作者: dlkfth

select   a.*,b.*,c.*   from   a   inner   join   b   on   a.no=b.no  
  inner   join   c   on   a.no=c.no

NO.4   作者: Qihua_wu

不可能实现的

NO.5   作者: bzszp

sql语句不行

NO.6   作者: darkhorsedba

可以吧,就象LGQDUCKY(飘)说的,先问你是要这样的结果吗?  
  select   a.*,b.*,c.*   from   a   a,b   b   ,c   c  
      where   a.主键   =   b.引用a的主键   and   a.主键   =   c.引用a的主键;  
 

NO.7   作者: beckhambobo

不清楚楼主所表达意图是怎样,列个例子吧

NO.8   作者: bluemeteor

一行多条记录?  
   
  有多少条?条数固定的话可以,用case或者if

NO.9   作者: bluemeteor

明白了,不能实现

NO.10   作者: qinkm

你这是个交叉表,可以实现的.  
  select   a.no,a.name,a.id,  
  decode(b.remark,aaaaa,b.remark)   aaaaa,  
  decode(b.remark,bbbbb,b.remark)   bbbbb,  
  decode(c.thing,ccccc,b.thing)   ccccc,  
  decode(c.thing,ddddd,b.thing)   ddddd    
  from   a,b,c    
  where   a.no=b.a_no   and   a.no=c.a_no

NO.11   作者: bydngs

好像用sql语句不行

NO.12   作者: dongxi_wang

前台处理

NO.13   作者: sdmity

select   a.no,a.name,a.id,  
  decode(b.a_no,a.no,b.remark)   aaaaa,  
  decode(c.a_no,a.no,c.thing)   ddddd    
  from   a,b,c    
  where   a.no=b.a_no   and   a.no=c.a_no  
 

NO.14   作者: beckhambobo

基本方法如下,能不能实现看数据:  
  select   no,name,  
  max(   decode(   a_no,   no,   remark,   null   )   )   no_10,  
  max(   decode(   a_no,   no,   remark,   null   )   )   no_20,  
  .....  
  max(   decode(   a_no,   no,   thing,   null   )   )   no_30,  
  max(   decode(   a_no,   no,   thing,   null   )   )   no_40,  
  ....  
  from   a,b,c  
  where   a.no=b.a_no(+)   and   a.no=c.a_no(+)  
  group   by   no,name


 ·sql 不能轻易完成的功能    »显示摘要«
    摘要: a | b | c 1000262 | 0.75449 | 2376.6471 1000262 | 0.74117 | 2267.7307 1000262 | 0.74556 | 2267.7191 1000262 | 0.74556 | 2267.7191 在foxpro中: selec a,b,c from chkdb group by 1 where a =1000262 a ......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE