declare detail Cursor for select  片名  from table--你用的表名 declare @Name varchar(20)
declare @OldName varchar(20)
set @OldName=''create table #temp
Open detailFetch Next From detail  into @Name
while @@Fetch_Status=0 
begin
   if @OldName<>@Name 
   begin
      set  @OldName=@Name
  end 
  else
  begin
      update #temps set Name=null where Current of Detail
  endFetch Next from detail into @Name
end
close detail
deallocate detailset nocount offselect Name,side from #temps
order by name

解决方案 »

  1.   

    select distinct 片名 from ...  query1
    select a.片面,b.片面 from a as b where 片名= query1.fieldbyname("片名")
      

  2.   

    Select d1.片名, d2.片面 as A面, d3.片面 as B面
    From
    (Select Distinct 片名 From Table) d1,
    (Select 片名, 片面 From Table Where 片面='A') d2,
    (Select 片名, 片面 From Table Where 片面='B') d3
    Where d1.片名*=d2.片面
     and  d1.片名*=d3.片面我给你写出来了,牛吧?快给分!