Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

sqlÖг£Óö¯Ì¬µÄÐÐתÁÐ

//È¡³öÔ´Êý¾Ý
select groupname,totalnum,inputdate,groupid into #temp from
 (select count(*)as totalnum,p.groupid,g.groupname,convert(nvarchar(10),inputdate,120) as 'inputdate'
 from person p left join admin_group g on p.groupid = g.groupid and deleteflag = '0'
 where p.inactive='0' 
 group by p.groupid,g.groupname,convert(nvarchar(10),p.inputdate,120)) a
 left join
 (select a.groupid as areagroupid,b.groupname as area,b.areaid
 from admin_group a inner join admin_group b on a.upperid = b.groupid) b on a.groupid=b.areagroupid
//µÚÒ»ÖÖ·½Ê½Äܹ»¿ØÖÆÏÔʾµÄÊý¾ÝµÄÑùʽ£¬ËٶȱȽϿì
declare @s nvarchar(max)
select @s = 'select groupname as ÉçÇøÃû,groupid'
select @s = @s + ',isnull(max(case when inputdate=''' + cast(inputdate as varchar(10)) + ''' then totalnum end),0) as ''' + cast(inputdate as varchar(10)) + ''''  from #temp group by inputdate order by inputdate desc
select @s = @s + ' from #temp where groupid=71 group by groupname,groupid'
exec(@s)
//µÚ¶þÖÖʹÓÃpivot£¨sql2005ÒÔÉÏ°æ±¾ÖÐÓУ©
declare @s nvarchar(max)
Select     @s=isnull(@s+',','')+quotename(inputdate) from #temp group by inputdate order by inputdate desc
exec('select * from #temp pivot (max(totalnum) for inputdate in('+@s+'))b')


Ïà¹ØÎĵµ£º

SQLÊý¾Ý¿âÖ®¶þ

l  INNER JOIN
ÄÚÁ¬½ÓÊÇ×î³£¼ûµÄÒ»ÖÖÁ¬½Ó£¬ËüÒ³±»³ÆΪÆÕͨÁ¬½Ó£¬¶øE.FCodd×îÔç³Æ֮Ϊ×ÔÈ»Á¬½Ó¡£
ÏÂÃæÊÇANSI SQL£­92±ê×¼
select *  from    t_institution i
inner join t_teller t
on i.inst_no = t.inst_no  //˵Á½¸ö±íÖ®¼äµÄ¹ØϵÓÃON
where i.inst_no = "5801"
ÆäÖÐinner¿ÉÒÔÊ¡Â ......

SQL SERVER 2005 »ù±¾²éѯ£¨Á¬½Ó²éѯ£©

use AdventureWorks
GO
SELECT c.LastName from Person.Contact c;
SELECT * from HumanResources.Employee e
INNER JOIN HumanResources.Employee m
 ON e.ManagerID = m.EmployeeID; n
SELECT ProductID,Name,ProductNumber,ReorderPoint
from Production.Product
where ProductID in( select ProductID fro ......

SQL SERVER 2005 ¸ß¼¶²éѯ£¨×Ó²éѯ²éѯ£©

--SQL¸ß¼¶³ÌÐòÉè¼Æ£º×Ó²éѯ
use AdventureWorks
GO
SELECT DISTINCT EmployeeID from HumanResources.JobCandidate WHERE EmployeeID IS NOT NULL;
SELECT e.EmployeeID,FirstName,LastName
from HumanResources.Employee e
INNER JOIN Person.Contact c
 ON e.ContactID = c.ContactID
WHERE e.EmployeeID IN ......

phpmyadmin ÐÞ¸ÄÖ´ÐÐsqlÎļþ´óСÏÞÖÆ

phpmyadmin ÐÞ¸ÄÖ´ÐÐsqlÎļþ´óСÏÞÖÆ
´ò¿ªphp.ini
post_max_size = 100M       ; ±íµ¥Ìá½»Îļþ´óСÉÏÏÞ
memory_limit = 128M    ; ÄÚ´æÉÏÏÞ
upload_max_filesize = 100M ; ÉÏ´«Îļþ´óСÉÏÏÞ
ÐÞ¸ÄÒÔÉÏÈýÏ¾Í¿ÉÒÔ½â¾ö¡£ µ«ÊÇ´ËʱPHPMYADMINÖÐ×î´óÏÞÖÆ£º22,528 KB£¬ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ