数据库中加条件判断来决定显示的数值

发表于:2007-05-25来源:作者:点击数: 标签:数据库中加决定判断条件
SELECT jxc_yj_xzwz.clmc AS 物资名称, jxc_yj_xzwz.ggxh AS 规格型号,
      CAST(jxc_yj_xzwz.sl AS int) AS 数量, ISNULL(scdwbmk.dwmc, '') AS 所属部门,
      CASE jxc_yj_xzwz.syqk WHEN '0' THEN '未使用' ELSE '使用' END AS 使用情况,
      SUBSTRING(CONVERT(varchar, jxc_yj_xzwz.rq, 20), 1, 10) AS 制造日期,
      jxc_yj_xzwz.zdr AS 制单人, jxc_yj_xzwz.bz AS 备注
FROM jxc_yj_xzwz LEFT OUTER JOIN
      scdwbmk ON jxc_yj_xzwz.bmbm = scdwbmk.dwbm

原文转自:http://www.ltesting.net