I’m making a discord.py bot and I’m currently on the economy part, but I’m encountering a strange error that I’ve never ran into before and has most of the python discord help dumbfounded. The error is as follows: Command raised an exception: AttributeError: ‘Result’ has no…
Tag: sql
Extract the record for last hour for specific date
I am trying to extract the last hour (TKT_DT) record for number of tickets (TKT_DN) from sales table (PS_TKT_HIST) for specific date (BUS_DAT). I have the following code but it extracts the number of tickets (TKT_NO) for each hour. I want to filter the last hour only. Here is the code I used: I get the flowin…
expected that this query will not output 0 values, but it does [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed last month. Improve this question I expected that this query will not output 0 values, but it does. I thought that and (……
org.h2.jdbc.JdbcSQLSyntaxErrorException: Syntax error in SQL statement “drop table if exists [*]user CASCADE “; expected “identifier”; SQL statement:
I’ve below data.sql file in my src/main/resources/data.sql file. I would like user tabel to be created from user.csv file. When the spring application starts it always errors out with below error – Caused by: org.h2.jdbc.JdbcSQLSyntaxErrorException: Syntax error in SQL statement “drop table …
Group By Month between two dates
I have a table that lists all employees and their respective start and end dates I want to be able to count the number of active employees in each month. Is there a way to do this via a single query (eg groupBy) rather than generating multiple queries for each month? As an example, the table above should retu…
What does back to back table references mean in SQL from clause
I am looking at a query from crystal reports and it shows a table name immediately followed by a table name. see below if that didn’t make sense but I am trying to understand what this syntax is/does? thank you in advance for any insight Answer The 2nd name is the alias. It allows you to refer to the ta…
PostgreSQL query which return metrics joining different tables need to be more efficient and fast
I have a query that can be seen on this fiddle and I’m relatively new to PSQL, having a few months of experience. DB Fiddle The link to the third party is to show the result of it otherwise would be difficult to visualize it here. This query collects and returns some metrics joining 3 tables about candi…
How to convert varchar2 input parameter to timestamp in stored procedure
We are using a proprietary product to develop our application. This product is capable of connecting to Oracle DB and executes SQL queries and stored procedures. However, today we found a weird issue that this product is not able to execute a stored procedure if there is a timestamp input parameter in stored …
How to select DISTINCT records based on multiple columns and without considering their order
I’m currently working on a SQL Server database and I would need a query that returns pairs of customers with the same city from a table that has this structure and this sample data I have tried defining a query that joins the Customer table itself but it gives me a table that looks like this with duplic…
How to select the best item in each group?
I have table reports: In human language: there are reports for each month. Each report could be in XML or CSV format. There could be 1-2 reports for each month in unique format. I want to select the reports for all months, picking only 1 file for each month. The XML format is more preferable. So, expected out…