Http://www.cnblogs.com/sadier/archive/2004/11/18/65170.html
Requirements:
An article table: there is PostID (article number), ParentID (associated article PostID), SourceID (an article associated)
Originally wrote a statement, found that can not run.
SELECT Pkid, Title, Author, Operatedate, Text, PostID, ParentID, PostID as SortID
From Tbl_post
WHERE (ParentID = 2) and (Posttype = 3 OR
Posttype = 7) and (Deleteflag = 0)
UNION
SELECT Posta. Pkid, Posta. Title, Posta. Author, Posta. Operatedate, Posta. Text, Posta. PostID,
Posta. ParentID, Postb. PostID as SortID
From Tbl_post Posta INNER JOIN
Tbl_post Postb on Posta. PostID = Postb. SourceID
WHERE Posta. ParentID = 2 and Posta. Deleteflag = 0 and Postb. ParentID = 2 and
Postb. Deleteflag = 0
ORDER BY SortID
Think of a DataSet. Merge, the following succeeded
DataSet ds = new DataSet ();
String strSQL = String.Format (@) Select Tbl_config.blogid ID, Tbl_config.author Name
From Tbl_post,tbl_config
where Tbl_post.operater = Tbl_config.blogid
and PostID = {0} and Tbl_config.blogid > 2 ", PostID);
DataTable dt = Jumpdbprovider.select (strSQL);
Dt. PrimaryKey = new Datacolumn[1]{dt. columns["ID"]};
Ds. Tables.add (dt. Copy ());
strSQL = String.Format (@ Select GroupID id,groupname Name
From Tbl_group, Tbl_postright
where tbl_postright.tempid = Tbl_group.groupid
and Isgroup = 1
and PostID = {0} and Active = 1 ", PostID);
DataTable DTM = Jumpdbprovider.select (strSQL);
Ds. Merge (Dtm,false,missingschemaaction.add);
Return DS. Tables[0];