需要啊。
table里有多个重复记录,所以用了distinct。但我还需要一个空字符串或者其他的与table无关的字符串。

解决方案 »

  1.   

    select distinct fileldname1,newcol='' from talbe1
      

  2.   

    to yangtom():
    不行,他说找不到newcol这个列
      

  3.   

    是新增一个空列吗?yangtom()写法有问题。
    select distinct fileldname1,''as newcol from talbe1 into cursor tmp
    or 
    select distinct fileldname1,space(1) newcol from talbe1 into cursor tmp
      

  4.   

    sorry,我说错了
    是select distinct后在fieldname1列中增加一个空字符串
    fieldname1这一列在table中是字符串型,可能有空值,也可能没有
      

  5.   

    select distinct(fileldname1),null,1,'sdfsd' from tablename;
    其中null,1,sdfjsdf 都是另加的表中没有的字段,结果如下:
    fileldname1     N    1 'SDFS
    ---------- - --------- -----
    990011               1 sdfsd
    990013               1 sdfsd
    990015               1 sdfsd
      

  6.   

    也许是我表达错了
    我是想在字段fieldname1中添加一个空字符串“值”,而不是在cursor tmp中添加字段。前提是fieldname1字段值经过distinct的,没有重复值了,而且fieldname1这一列在表中是允许有空值的,也就是说fieldname1这一列可能有空值,也可能没有 。
      

  7.   

    select distinct(fieldname1 + ' ') as fieldname1 from tablename
      

  8.   

    to supsuccess(口气不小):
    这个我好像试过。试试看。
      

  9.   

    to supsuccess(口气不小):
    sorry ,还是不行。
    你这个(fieldname1 + ' ')不是只在每个值的后面加上一个空串吗?
    可是我是想得出一列没有重复的值以后,再在这一列的值后面再添加一个空字符串。
      

  10.   

    试试这个:
    select distinct fieldname1 from tablename union select '' from tablename
      

  11.   

    to curio(weird):
    搞踮,thx
    不过不能用order by字句,
    “select distinct fieldname1 from tablename union select '' from tablename order by fieldname1 asc”出错,语法错误。
      

  12.   

    select fieldname1 from (select distinct fieldname1 from tablename union select '' from tablename ) tt order by fieldname1 asc
      

  13.   

    你加一个as fieldname1就可以了,呵呵
    select distinct fieldname1 from tablename union select '' as fieldname1 from tablename order by fieldname1