帮我解释下这个查询语句@select c_id,c_gcode,c_number into #11 from tb_bi

1个回答

  • select c_id,c_gcode,c_number into #11 from tb_bill_rg 的意思是:在tb_bill_rg 表中查询c_id,c_gcode,c_number字段写入#11表中相应字段.

    where c_id in(select c_id from tb_bill_r where datediff(day,c_au_time,'2007-04-01')=0 and c_ad_from like '2%') and c_gcode not in(select c_gcode from tb_d_sum_gds

    where c_number_move>0 and datediff(day,c_dt,'2007-04-01')=0 and c_adno like '2%')

    这些是查询条件.

    这个的意思是tb_bill_rg 表中c_id字段等于tb_bill_r表中c_au_time字段在2007年4月1日之后并在2007年5月20日之前并且c_ad_from字段为‘2’开头的记录中的c_id字段并且c_gacode字段不包含于tb_d_sum_gds表中c_number_move大于零并且c_dt字段在2007-4-1之后和2007-5-20之后的记录并且c_adno以‘2’开头.

    order by c_gcode

    这个是以c_gcode升序排序.

    select #11.c_id,#11.c_gcode,#11.c_number,tb_gds.c_name from #11,tb_gds where #11.c_gcode=tb_gds.c_gcode

    order by #11.c_gcode

    查询表#11,tb_gds中的#11.c_id,#11.c_gcode,#11.c_number,tb_gds.c_name字段其中#11表的c_gcode等于tb_gds表的_gcode

    以#11表中c_gcode字段排序.