这种样式的SQL怎么写?
有一组确定的值‘aaa’,‘bbb’,‘ccc’,‘ddd’
我想判断他不在另一张表(table)的一列(Filed)里面,如何用一条SQL语句搞定,
之前很傻的写成:
select (‘aaa’,‘bbb’,‘ccc’,‘ddd') not in select Filed from table
SQL code:
select count(1from [table] where filed not in('aaa’,‘bbb’,‘ccc’,‘ddd') ?
)
SQL code:
select count(1) from [table] where filed not in('aaa’,‘bbb’,‘ccc’,‘ddd') ?
學習
怎么样的结果,贴出来
SQL code:
select code
from
(
select 'aaa' as code
union all select 'bbb'
union all select 'ccc'
union all select 'ddd'
) t
where code not in (select Filed from table )
SQL code:
Create table table1
(
Filed varchar(8000)
)
insert into table1 values ('aaa')
insert into table1 values ('bbb')
insert into table1 values ('ccc')
insert into table1 values ('ddd')
insert into table1 values ('eee')
insert into table1 values ('fff')
select Filed from table1
相关问答:
我要做一个定点事件,是每天晚上12点就把三个表里的信息放入一个表里,我想用存储过程来写,怎么写呢?,那位高手帮帮忙吧,非常感谢!
用户名是唯一的
表A 字段
用户名:Name ,邮箱:Ema ......
sql我想得到一字符串为:
sldkf|||sdeww
erkv|||rltdk
jemcl|||ligf
就是|||后面的字符有什么函数能得到吗?是在sql语句写的,不是在页面写的,那位高手来指教下,新手,谢谢
晕今天不是写了么
select parsen ......
<table style="width: 1000px"><tr>
<td style="height: 38px; width: 35px;">
姓名</td>
......
可能因为工作的原因 接触数据库这块比较少,之前都是做程序这块,数据库这块都有专门的人来做 分工都很明细 所以对数据库这一块完全不了解。前段时间 去面试了几家公司 几乎都是在数据库这块挂掉的 连个简单的SQ ......
protected void btnLogin_Click(object sender, EventArgs e)
{
SqlConnection conn = new SqlConnection("Server = (local);user id = sa;pwd = 1;database = Login");
&nb ......