I have to perform incremental load thorough Talend, for that i have to write query in SQL Builder, but it is not returning more than 10 records.
For Oracle code i have Tried below
1. Checked SQL -Limit number of row - not working
2. ROWNUM < = 100 - not working
Could anyone suggest on this.
Related
I have an issue with the Data set - Execution server. I am using PostgreSQL as DB. I want to calculate the difference between the two dates column for my report. The query I have used in DB is:
Query 1:
SELECT end_date as end,
start_date as start,
processid as pidd,
AGE(end_date, start_date) as duration
from processinstancelog
Query 2:
select end_date,start_date,processid, end_date - start_date as
duration from processinstancelog
Both queries reflecting the correct expected result in Postgres DB. But when I am using the same queries in the Data set>Execution server it's not showing the "duration" column.
Question
Can anyone please advise what is issue why the data set is not showing the duration column?
Many Thanks
Both queries reflecting the correct expected result in Postgres DB. But when I am using the same queries in the Data set>Execution server it's not showing the "duration" column.
How do you use in the query in the execution server? Are you implementing advance query functionality? If yes can you please share the exact steps you are following and your advance query definition to review.
Answer, I deleted the old setup and installed the new setup for JBPM and data set start appearing
I'm using TABLEAU Datasource option to run Custom SQL "Select count() from table_name. It is based on a ODBC connection. Unfortunately, I have 400 tables that I need to run my script with 400 lines of "Select count()" , Tableau is not returning the total # of records and is only returning ZEROs. I'm using the Edit Custom SQL option from the Datasource Tab.
I have tried using the View Result after Opening the Edit Customer SQL and selecting the View Result to get the total count. My plan was to include all he 400 select counts in one script and run it. It worked fine as a part of my connection to another database but not ODBC.
SELECT COUNT(*) FROM ACCOUNTING_BOOKS
The expected result should be,
Select Edit Customer SQL
View Result
Get a listing of counts.
According to this answer count isn't available as a NetSuite function. You might want to follow the link in that article (if you have a NetSuite account) to see if this has changed.
When I aggregate values in Google Data Studio with a date dimension on a PostgreSQL Connector, I see buggy behaviour. The symptom is that performing COUNT(DISTINCT) returns the same value as COUNT():
My theory is that it has something to do with the aggregation on the data occurring after the count has already happened. If I attempt the exact same aggregation on the same data in an exported CSV instead of directly from a PostgreSQL Connector Data Source, the issue does not reproduce:
My PostgreSQL Connector is connecting to Amazon Redshift (jdbc:postgresql://*******.eu-west-1.redshift.amazonaws.com) with the following custom query:
SELECT
userid,
submissionid,
date
FROM mytable
Workaround
If I stop using the default date field for the Date Dimension and aggregate my own dates directly in within the SQL query (date_byweek), the COUNT(DISTINCT) aggregation works as expected:
SELECT
userid,
submissionid,
to_char(date,'YYYY-IW') as date_byweek
FROM mytable
While this workaround solves my immediate problem, it sucks because I miss out on all the date functionality provided by Data Studio (Hierarchy Drill Down, Date Range filtering, etc.). Not to mention reducing my confidence at what else may be "buggy" within the product 😞
How to Reproduce
If you'd like to re-create the issue, using the following data as a PostgreSQL Data Source should suffice:
> SELECT * FROM mytable
userid submissionid
-------- -------------
1 1
2 2
1 3
1 4
3 5
> COUNT(DISTINCT userid) -- ERROR: Returns 5 when data source is PostgreSQL
> COUNT(DISTINCT userid) -- EXPECTED: Returns 3 when data source is CSV (exported from same PostgreSQL query above)
I'm happy to report that as of Sep 17 2020, there's a workaround.
DataStudio added the DATETIME_TRUNC function (see here https://support.google.com/datastudio/answer/9729685?), that allows you to add a custom field that truncs the original date to whatever granularity you want, without causing the distinct bug.
Attempting to set the display granularity in the report still causes the bug (i.e., you'll still set Oct 1 2020 12:00:00 instead of Oct 2020).
This can be solved by creating a SECOND custom field, which just returns the first, and then you can add IT to the report, change the display granularity, and everything will work OK.
I have the same issue with MySQL Connector. But my problem is solved, when I change date field format in DB from DATETIME (YYYY-MM-DD HH:MM:SS) to INT (Unixtimestamp). After connection this table to the Googe Datastudio I set type for this field as Date (YYYYMMDD) and all works, as expected. Hope, this may help you :)
In this Google forum there is a curious solution by Damien Choizit that involves combining your data source with itself. It works well for me.
https://support.google.com/datastudio/thread/13600719?hl=en&msgid=39060607
It says:
I figured out a solution in my case: I used a Blend Data joining twice the same data source with corresponding join key(s), then I specified a data range dimension only on the left side and selected the columns I wanted to CTD aggregate as "dimensions" (and not metric!) on the right side.
Using Oracle - I'm looking for a way to sum records for over multiple rows and multiple tables
Example:
SQL (without using Crystal) looks something like this:
SELECT D.REC ,D.CODE,
(SELECT SUM(AMT)
FROM TableT T2
WHERE T2.DELETED = 0
AND D.REC = T2.RID
AND T2.TYPE = 65
AND T2.RES <> 10
AND LOT = 6) AS T2Total
FROM TableD D
WHERE D.DELETED=0
GROUP BY D.CODE, REC
ORDER BY D.CODE
There are more subselects and calculations in which I am no longer reading from 2 tables, but 4 and the records selected no longer have the same relationship and I was wondering if there was a way for me to write this in Crystal, I haven't found a way to create a stored proc for this
Any ideas/help is much appreciated.
Best way in my opinion would be creating a VIEW for such scenarios. Add whatever you want to the view and then use the view in your report.
I am using Crystal Reports Developer Studio to create a report that reports on two different tables, let them be "ATable" and "BTable". For my simplest task, I would like to report the count of each table by using Total Running Fields. I created one for ATable (Called ATableTRF) and when I post it on my report this is what happens:
1) The SQL Query (Show SQL Query) shows:
SELECT "ATABLE"."ATABLE_KEY"
FROM "DB"."ATABLE" "ATABLE"
2) The total records read is the number of records in ATable.
3) The number I get is correct (total records in ATable).
Same goes for BTableTRF, if I remove ATableTRF I get:
1) The SQL Query (Show SQL Query) shows:
SELECT "BTABLE"."BTABLE_KEY"
FROM "DB"."BTABLE" "BTABLE"
2) The total records read is the number of records in BTable.
3) The number I get is correct (total records in BTable).
The problems starts when I just put both fields on the reports. What happens then is that I get the two queries one after another (since the tables are not linked in crystal reports):
SELECT "ATABLE"."ATABLE_KEY"
FROM "DB"."ATABLE" "ATABLE"
SELECT "BTABLE"."BTABLE_KEY"
FROM "DB"."BTABLE" "BTABLE"
And the number of record read is far larger than each of the tables - it doesn't stop. I would verify it's count(ATable)xcount(BTable) but that would exceed my computer's limitation (probably - one is around 300k rows the other around 900k rows).
I would just like to report the count of the two tables. No interaction is needed - but crystal somehow enforces an interaction.
Can anyone help with that?
Thanks!
Unless there is some join describing the two tables' relationship, then the result will be a Cartesian product. Try just using two subqueries, either via a SQL Command or as individual SQL expressions, to get the row counts. Ex:
select count(distinct ATABLE_KEY) from ATABLE
If you're not interested in anything else in these tables aside from the row counts, then there's no reason to bring all those rows into Crystal - better to do the heavy lifting on the RDBMS.
You could UNION the two queries. This would give you one record set containing rows from each query once.