private void AppendWhere(UnionSubQuery unionSubQuery, string newWhereStr)
        {
            SQLExpressionAnd resultWhere;

            // parse and prepare new WHERE expression
            SQLExpressionItem newWhere = ParseExpression(newWhereStr);

            // if there are no new expression - nothing to do
            if (newWhere == null)
            {
                return;
            }

            // extract old WHERE expression
            SQLExpressionItem oldWhere = unionSubQuery.QueryColumnList.GetConditionTree(new[] { ConditionType.Where });

            // normalize old WHERE expression
            if (oldWhere != null)
            {
                oldWhere.RestoreColumnPrefixRecursive(true);
            }

            // simplify old WHERE expression
            if (oldWhere != null)
            {
                // if old WHERE is a collection of ORed or ANDed expressions
                // with only one expression in the list - remove the external list
                while (oldWhere is SQLExpressionLogicalCollection &&
                       ((SQLExpressionLogicalCollection)oldWhere).Count == 1)
                {
                    using (SQLExpressionLogicalCollection tmp = (SQLExpressionLogicalCollection)oldWhere)
                    {
                        oldWhere = tmp.Extract(0);
                    }
                }
            }

            // combine old and new WHERE expressions
            resultWhere = new SQLExpressionAnd(queryBuilder1.SQLContext);

            if (oldWhere != null)
            {
                resultWhere.Add(oldWhere);
            }

            resultWhere.Add(newWhere);

            // fix up combined WHERE expression
            FixupExpression(unionSubQuery, resultWhere);

            // defer SQL updates
            unionSubQuery.BeginUpdate();

            try
            {
                // clear old WHERE expression
                ClearWhere(unionSubQuery);

                // load new WHERE expression (if exists)
                unionSubQuery.QueryColumnList.LoadConditionFromAST(resultWhere, ConditionType.Where);
            }
            finally
            {
                // enable SQL updates
                unionSubQuery.EndUpdate();
            }
        }