今天写了个sql,发现查询的数据有问题。sql如下: select?*?from?t?where?field<>‘aaa‘ 数据库中,该字段某些行是自动填充的,为NULL。但是使用该语句查询,却没有包含这些数据。 之前对NULL的理解是,NULL不...
分类:
数据库 时间:
2014-07-22 08:37:37
阅读次数:
256
SELECT?a.Pid,a.id?FROM?`user`?as?b,`reward`?as?a?WHERE?b.id=4?and?a.Pid?=?b.Pid; 在执行上面语句是报错:Illegal mix of collations (ucs2_general_ci,IMPLICIT) and (utf8_general_ci,IMPLICI...
分类:
数据库 时间:
2014-07-21 10:33:24
阅读次数:
235
查询及删除重复记录的SQL语句 1、查找表中多余的重复记录,重复记录是根据单个字段(peopleId)来判断 select * from people where peopleId in (select?? peopleId from?? people group by?? peopleId hav...
分类:
数据库 时间:
2014-07-21 10:29:12
阅读次数:
265
一、 1)如果id字段不為null,就加在isNotNull标签语句前加上“and”。2)标签会覆盖子标签中的prepend,上例中,中没有prepend,所以子标签中and会保留。此处的用法是where 1=1,然后是动态sql。还可以,这样可以覆盖子标签中的and,使其变成where。二、...
分类:
数据库 时间:
2014-07-21 10:23:10
阅读次数:
203
无意中看到别人说sql语句加where 1=1会低效,所以就测试下: 新建测试表: USE [gk4]
GO
/****** 对象: Table [dbo].[Table_1] 脚本日期: 07/18/2014 15:34:02 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDE...
分类:
数据库 时间:
2014-07-21 10:21:07
阅读次数:
333
一直以为mysql忽略大小写只是针对表名及字段名这一些。?没有想到数据也忽略大小写。 SELECT * from tt where name = ?‘AA‘; id ????????name ???????age 1?????????aa????????...
分类:
数据库 时间:
2014-07-21 10:17:01
阅读次数:
229
select?sku,COUNT(sku)?cc?from?sales_flat_order_item?where?order_id?in(SELECT?entity_id?from?sales_flat_order?where?state?in(‘complete‘,‘processing‘))?GROUP?BY?sku?ORDER?BY?cc?D...
分类:
数据库 时间:
2014-07-21 10:08:17
阅读次数:
250
在项目开发过程中,要删除表中的记录数据,但是给的字段值不是本表中的字段值,试了很多方法都没有成功,最后看到这个方法挺好用的: DELETE?g?FROM?ws_group_users?g,?yf_user?u?WHERE?g.userid=u.id?a...
分类:
数据库 时间:
2014-07-21 10:08:04
阅读次数:
265
Givennnon-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in the histog...
分类:
其他好文 时间:
2014-07-21 10:04:43
阅读次数:
229
What's xxxThe EM algorithm is used to find the maximum likelihood parameters of a statistical model in cases where the equations cannot be solved dire...
分类:
其他好文 时间:
2014-07-21 10:01:10
阅读次数:
243