SqlServer 查B表中不含A表中的数据

	 		sb = new StringBuffer("SELECT a.* ");
	        sb.append(" FROM Table_A a ");
	        sb.append(" LEFT JOIN B b ON a.CLJCRLSH = b.CLJCRLSH and a.jccs =b.jccs ");
	        sb.append(" where ");
	        sb.append(" ((b.CLJCRLSH IS NULL and b.jccs is null) or (b.CLJCRLSH =a.CLJCRLSH and b.jccs !=a.jccs)) ");
	        if (orders != null) {
	            sb.append(orders);
	        }
	        sb.append(" order by a.JCKSSJ desc ");

你可能感兴趣的:(SqlServer 查B表中不含A表中的数据)