Join and Table-valued function

31 views
Skip to first unread message

Alexander Byndyu

unread,
Jan 24, 2013, 1:13:00 AM1/24/13
to nhu...@googlegroups.com
Hello,

How can I create query:

SELECT *
FROM Post po 
INNER JOIN GetPostBySearchQuery('search query') s ON s.Id = po.PostId

GetPostBySearchQuery - table-valued function, returns PostId list.


Oskar Berggren

unread,
Jan 24, 2013, 1:41:57 AM1/24/13
to nhu...@googlegroups.com
ISession.CreateSQLQuery(), or use a named-query. See the NHibernate
reference documentation.

/Oskar


2013/1/24 Alexander Byndyu <alexande...@gmail.com>:
> --
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/nhusers/-/LJzQI01UoyQJ.
> To post to this group, send email to nhu...@googlegroups.com.
> To unsubscribe from this group, send email to
> nhusers+u...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.

Alexander Byndyu

unread,
Jan 24, 2013, 5:27:46 AM1/24/13
to nhu...@googlegroups.com
More correct formulation of the question:

Simplified code:

            IQueryOver<Post, Post> query =
                Session.QueryOver<Post>();

            if (string.IsNullOrEmpty(criterion.SearchQuery) == false)
            {
                // join results from GetPostBySearchQuery function
            }

If criterion.SearchQuery is not empty I should call Sphinx function.

SQL result should by like:

SELECT * FROM Post po
INNER JOIN GetPostBySearchQuery('search query') s ON s.Id = po.PostId

Best regards,
Byndyu Alexander


2013/1/24 Oskar Berggren <oskar.b...@gmail.com>
Reply all
Reply to author
Forward
0 new messages