sql语句,查出同一表中同一列不同类型的数据同时查出。

2025-02-24 21:28:01
推荐回答(3个)
回答1:

select * from tab where C='33' or C='34';
or是或者,其一匹配就会显示,所以33和34都会显示
and是而且,也就是两个条件必须同时满足

回答2:

SqlConnection cn = new SqlConnection("server=(local);user id=sa;pwd=;Database=db_10"); //连接数据库
//建立SQL语句与数据库的连接
SqlDataAdapter dap = new SqlDataAdapter("select distinct A,B,C,D from tab where C=33 OR C=34 in (select A,B,C,D from tab where A)", cn);

回答3:

select * from tab where c<35 and c>32