select RPAD(substring(b.Name,1,1),3,'*') as Name,a.NoteID as NoterID, a.Noter as Noter, a.Title as Title,
IFNULL(CONVERT(a.Body USING utf8), "") as "Body",
DATE_FORMAT(a.NoteTime,'%Y-%m-%d %H:%i:%s') as "CreateTime"
from T_SYS_NOTES as a join T_C_CUSTOMERS as b on a.Noter=b.CustomerID
where 20121116140409 in(a.NoteID, a.ParentNoteID) and a.Status=0 and a.ParentNoteID not in (0)
union all
select "游客" as Name, a.NoteID as NoterID, a.Noter as Noter, a.Title as Title,
IFNULL(CONVERT(a.Body USING utf8), "") as "Body",
DATE_FORMAT(a.NoteTime,'%Y-%m-%d %H:%i:%s') as "CreateTime"
from T_SYS_NOTES as a where 20121116140409 in(a.NoteID, a.ParentNoteID)
and a.Status=0 and a.Noter is null and a.ParentNoteID not in (0)
order by CreateTime asc limit 10;
这个语句能在数据执行并显示全部的字段,但是当我在action中打印时Name字段显示不出任何东西来,这是为什么,我用的mybatis的框架
IFNULL(CONVERT(a.Body USING utf8), "") as "Body",
DATE_FORMAT(a.NoteTime,'%Y-%m-%d %H:%i:%s') as "CreateTime"
from T_SYS_NOTES as a join T_C_CUSTOMERS as b on a.Noter=b.CustomerID
where 20121116140409 in(a.NoteID, a.ParentNoteID) and a.Status=0 and a.ParentNoteID not in (0)
union all
select "游客" as Name, a.NoteID as NoterID, a.Noter as Noter, a.Title as Title,
IFNULL(CONVERT(a.Body USING utf8), "") as "Body",
DATE_FORMAT(a.NoteTime,'%Y-%m-%d %H:%i:%s') as "CreateTime"
from T_SYS_NOTES as a where 20121116140409 in(a.NoteID, a.ParentNoteID)
and a.Status=0 and a.Noter is null and a.ParentNoteID not in (0)
order by CreateTime asc limit 10;
这个语句能在数据执行并显示全部的字段,但是当我在action中打印时Name字段显示不出任何东西来,这是为什么,我用的mybatis的框架
既然sql可以查询出结果,看下你的list对象里面name是否有值!
{Name=, NoterID=20121130092243},
{Name=,NoterID=20121130155811}]结果就是这样的,Name字段没有值,但是我同样的语句在数据库里面执行,是有值的。
我没有找到基础的
http://www.blogjava.net/alexprefect/articles/372967.html
这个希望你对照下 看看自己问题
http://www.cnblogs.com/wushiqi54719880/archive/2011/07/26/2117601.html