Requirements:
An article table with PostID (article number), ParentID (associated article PostID), and SourceID (associated article)
I wrote a statement and found that the statement cannot be 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 dataset. merge.
DataSet ds = new DataSet ();
String strSQL = String. Format (@ "select TBL_Config.BlogID, 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];