NHibernate - How to project a subquery as a column with a QueryOver - subquery

How would one achieve the following sql with the new NHibernate 3.0 QueryOver API?
select name, (select customertype from types where id = customer.id)
from customer
This is a simple query achievable with a standard join, but used to highlight the problem.

Related

How do I filter Azure Storage Table using OData Filter on unique Lastname in LogicApps?

I would like to filter on unique / distinct Lastname while using the Get Entities from the Azure Storage Table. Distinct is currently not supported and groupby also doesn't seem to fit. How can I filter on unique Lastname using the OData Filter?
At a moment there is no option to query directly with unique or distinct keywords. You can refer to this Official Documention for more information.
You can give feedback HERE for a Feature request.

Select clause editing in RedQueryBuilder

I'm looking into using RedQueryBuilder for a web-based query builder. I want my users to be able to specify what data they want to retrieve in the select clause, but the demo site
only shows selecting a single table, rendering all the columns of that table in the result. Does RedQueryBuilder support building out a more robust select clause, like specifying which specific columns to retrieve including those joined from other tables?
I'm afraid not. The project just concentrates on defining a query to return rows not what to show in those rows.
The onTableChange callback would feed you the list of tables in the expression so could go from that to a list of available columns...
Would you want/need to alter the SQL query generated or just the display of the results?
Personally I'd be interested in changing the demo into a more useful query too although the scope of that could be huge.

COGNOS report for a simple sub query and join Query

Here is my query. I am new to Cognos and using Cognos 10. And I am having a bit difficulty in developing a report which uses a Sub Query and an Inner Join Query.
1.
SELECT ID, BATCH_DT, LOCIT FROM AOI.TEMP_BRICK
WHERE BATCH_DT < (SELECT MAX(DATE) FROM CALENDAR)
2.
SELECT A.ID, B.SAL FROM TABLE as A LEFT OUTER JOIN TABLE as B
WHERE A.ID=B.ID
First, you must understand that Cognos generates its own SQL. In order for it to do that, you must define relationships between tables in Cognos Framework Manager. Once that is done your report has 3 major parts, The Report Page(s), the Prompt Page(s) and the Query(s).
a.) Setup the CALENDAR and AOI.TEMP_BRICK tables in Cognos. You may want to define a relationship between TEMP_BRICK.BATCH_DT and CALENDAR.DATE (assuming your calendar has date records for every date that may be present in TEMP_BRICK).
b.) Next you would create a new List Report. You would grab your ID, BATCH_DT and DATE fields into the list. (Date would come from the calendar if you decided to link the two tables in step A, otherwise you use the BATCH_DT field in TEMP_BRICK.)
c.) You would open the Query pages and see that Cognos has already created one query, called Query1. You need to create a new query (we will call it qryMaxDate). That query would have one element, 'DATE' from CALENDAR. On the properties of the 'DATE' field in Data Items, you would chagne the 'Agregate Function' from None to 'Maximum'.
d.) Now edit your Query1, add a Filter on the Date from that query. In the Expression Definition, select the Queries tab and drag the 'DATE' field from your qryMaxDate. Should look something like this [Batch Date] = [qryMaxDate].[Date]
e.) You are done! Run the report. in this case, the user running the report is giving no input, so no Prompt page is necessary.
a.) Setup Table A and B in the Framework Manager. You need to define a relationship between Table A and B in Framework Manager via a Star Schema (define A.ID = B.ID and specify 1 to n, or n to 1).
b.) Create a new report and simply drag in elements from table a and table b. Their relationship is already defined in Framework manager, so there is no need to re-define it while writing reports.
Your second example is a great demonstration of the power of BI programs like Cognos. Report Authors dont need to fully understand the ways that two tables are joined... they simply pull out elements from each table and they work, as the relationships are already defined in the Framework.

Sharepoint Aggregate lists

I'm trying to aggregate results from different list types. Using Join feature in Sharepoint designer won't cut it. What I want to achieve is eq. to in T-SQL "Select x AS y".
For example - The column "Title" doesn't exist in one list type but the column "Name" does.
What I want to do is as I would in SQL: "Select Name as Title"
I've tried looking into CAML but no luck there.
Much appreciated
V
You could achieve this using the Camelot .NET Connector for SharePoint, available at http://www.bendsoft.com/net-sharepoint-connector/
When using it you may question your SharePoint lists and document libraries as if they where ordinary SQL tables.
Ie.
SELECT LinkTitle as Title, CreatedDate as `Created Date`, ID as `List item id` FROM WhatEverListYouLike WHERE ID > 10
There are also predefined functions to handle most common operations of documents like FileUpload and FileDownload. These are covered in the documentation - http://docs.bendsoft.com/camelot-net-connector/latest/procedures/

How to do conditional insert when doing data migration using Scribe?

Here is the case:
I have an SQL Database table that I want to migrate to a Dynamic CRM 4.0 database. There is a table (let's call it Table_A ) that have a particular column (Table_A.Type). I want to migrate the table A data into either the Account entities or Contact entities in Dynamic depending on the Table_A.Type. If the Type is 0, I'll put it into Contact, else if the Type is 1, I'll put it into Account.
How can I do this using the Scribe Workbench?
The problem already solved. I use formula to put a condition in the migration flow.

Resources