is there a way to show executed queries with the value of passed named parameters, I tried query profiler in enterprise edition, but it only shows the base query.
e.g.
instead of: SELECT from Blog WHERE date BETWEEN :from AND :to
it should be: SELECT from Blog WHERE date BETWEEN 1-1-2015 AND 1-2-2015
thanks.
Related
I am having some trouble understanding the concept of Value groups/tags in Grafana 7.4.x with MySQL as a data source.
My main query gets the Countries
SELECT
NAME as __text,
id AS __value
from
countries
The tags query gets the Continents
SELECT
NAME as __text,
id AS __value
from
continents
That works so far, tags are shown in the list, but nothing happens once I click on them.
My tags query:
continents.$tag.*
The tags query seems to be the problem. Any help is greatly appreciated.
3 queries are involved:
The first one is under "Query Options" -> "Query": This one should list all the values (all the countries in your case).
The second query is the "Tags query" under "Value groups/tags": This query should list all the Tags you want (continents).
The third query is "Tag values query": This is where the magic happens, this query should return all the different values matching the selected tags, so, you must add a WHERE clause somewhere that Grafana will use to create a query to get the correct values, ...WHERE continent = '$tag'. <- $tag will automatically be replaced by a list of tags the user has chosen.
Be aware that the official documentation provides examples for InfluxDB datasource, since you are using MySQL, you must use SQL queries everywhere, so continents.$tag.* is invalid.
So I am trying to run a few queries and need to put them in Month group.
{"_id":{"$oid":"5f1021f15b43e19dabb13a81"},"artist":"Isaac Larson","song":"Network Protocol","station":"PERTHRadio","timeplay":{"$date":{"$numberLong":"1594896360000"}},"__v":{"$numberInt":"0"},"history":["8609f491-97e7-4862-a848-3712aeb2117e","3f102559-307a-45a5-a9fc-eaa84e0ed491"]}
(note picture is of the query above unsure why timeplay has copied from the database that way.
I have tried to use the documentation provided here https://docs.mongodb.com/manual/reference/operator/aggregation/month/
To fetch the month. However I'm having issues saying my query is wrong.
{$month:{'timeplay': new Date("Jul 16, 2020")}}
The error
The provided parameters were invalid. Check your query and try again.
Now that groupBy is deprecated, how can I mimic a SQL command like SELECT COUNT(*) FROM table GROUP BY xxx using the Waterline ORM ?
This page recommends using .sum() and .avg() but these methods are for number-type columns. Here I want to be able to count the rows of grouped columns, whatever type it is.
I think for specific groupBy query, you've got two choices.
The first one is a 2 step action.
1) Select all the unique element "group by field" you've got in the database.
2) Then count the record for each unique group by field element.
The second one is to use .sendNativeQuery() wich allow you to send a native SQL query to the datastore (you can use this only if you use a real SQL server and not the embedded Sails.JS database)
sendNativeQuery() Documentation
In Maximo 7.6.1.1, I can run a query on work orders with this WHERE clause: reportedby = :user:
When I hit Find the query runs successfully; it filters the records using the currently logged in user.
However, when I go back and look at the WHERE clause, I see that the dynamic variable (:user) has been replaced with a static value (JSMITH).
And when I look at the query table in Toad, I see that the clause has been saved as reportedby = 'JSMITH'.
This is not what I want.
How can I save a query with a dynamic variable?
(Oracle 12c)
You can use the View/Manage Queries dialog to change it back. When you first run it Maximo replaces the bind variables.
I'm using Crystal Reports 14 with an Oracle DB. If I have related tables Authors and Books and I selects all the authors that have book with 'code' in their title Crystal will put Books.title in the SQL SELECT clause, even if I don't use any Books fields anywhere in the report (except for the record selection). The query looks like this:
SELECT "AUTHORS"."NAME", "BOOKS"."TITLE"
FROM "AUTHORS" INNER JOIN "BOOKS" ON "AUTHORS"."ID"="BOOKS"."AUTHOR"
WHERE "BOOKS"."TITLE" LIKE '%code%'
This causes a problem because, even if I use the "Distinct" option, I will get many entries for each author (if they have more then one book with 'code' in the title). But what I want is only one entry by author. "Distinct" do not work here because each entry is really distinct, their book title are different.
How can I avoid getting "BOOKS"."TITLE" in the SELECT clause like this:
SELECT DISTINCT "AUTHORS"."NAME"
FROM "AUTHORS" INNER JOIN "BOOKS" ON "AUTHORS"."ID"="BOOKS"."AUTHOR"
WHERE "BOOKS"."TITLE" LIKE '%code%'
If that's not possible, what's the best workaround to get distinct authors in my scenario?
UPDATE
I should add that currently I'm using this formula in the Suppress details section:
{AUTHORS.ID} = previous({AUTHORS.ID})
The problem with this solution and also the group solution proposed by #Beth is that the query is the same and the DB return too much data for no reason. In both solutions the data is filtered/regrouped in Crystal Reports, not in the DB.
can you group by authors in your report and suppress the books.title details?
to group by author, in your report, under the Insert menu, select 'Group...' then select author.id in the first combo box and click OK. You'll notice your report has changed to introduce Group Header and Footer sections above and below the detail section. You can suppress the detail section and only the authors will print.
If you want only the authors to come across, you'll need to use a command sent to the data source with the SQL you want used, instead of using the tables directly like you are now.
You can create a command as your back-end with your parameter in it. You'll use that parameterized command instead of the tables you're using now. Try creating the command without the parameter first, then after you get that working, you can add your existing parameter into the command SQL.