Use CreateSQLQuery
http://nhforge.org/doc/nh/en/index.html#querysql
Diego
On Thu, Sep 2, 2010 at 04:55, Mind Works <[email protected]> wrote:
> Hi,
>
> I would like to fire the following SQL query through NH.
>
> SELECT <K.>, <K.>, <K.>, <K.>, <K.>, <K.>, <K.>
> FROM T1 q, T2 k
> WHERE (<field> like 'abc' or <field> like 'xyz')
> GROUP BY <K.>, <K.>, <K.>, <K.>, <K.>, <K.>, <K.>, <>
> HAVING count(<k.>) >= 2
> UNION
> SELECT <K.>, <K.>, <K.>, <K.>, <K.>, <K.>, <K.>
> FROM T1 q, T2 k
> WHERE ((<field> like 'abc%' and <field> <> 'xyz') or (<field> like 'abc
> %' and <field> <> '<value>'))
> GROUP BY <K.>, <K.>, <K.>, <K.>, <K.>, <K.>, <K.>, <W>
> HAVING count(<k.>) >= 2
> UNION
> SELECT <K.>, <K.>, <K.>, <K.>, <K.>, <K.>, <K.>
> FROM T1 q, T2 k
> WHERE (<> like 'abc')
> GROUP BY <K.>, <K.>, <K.>, <K.>, <K.>, <K.>, <K.>, <field>
> HAVING Count(<k.>) = 1
> UNION
> SELECT <K.>, <K.>, <K.>, <K.>, <K.>, <K.>, <K.>
> FROM T1 q, T2 k
> WHERE (<> like 'abc')
> AND <k.> = <q.> AND <K.> = 'J' AND NVL ( <K.>, 'N' ) != 'J'
> GROUP BY <K.>, <K.>, <K.>, <K.>, <K.>, <K.>, <K.>, <W>
> HAVING Count(<k.>) = 1
> ORDER BY <H> DESC;
>
> Is it possible to construct the above query in NH. One solution is to
> create a view of the above query and then fire the SQL on the view.
>
> Thanks & regards,
>
> Anil
>
> --
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<nhusers%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en.