I have a MySQL query for example: My table only have qty and filedatetime columns. Based on this query is it possible to query out the following conditions: if filedatetime is filedatetime >= ‘2019-08-01 06:30:00’ and filedatetime < ‘2019-08-01 18:30:00’ then assign value ‘…
the select convert function not working ! Return the syntax error?
I am using DBeaver. Here is my piece of code: This is the error: [42601]: ERROR: syntax error at or near “,” Because the data is too specific to extend of hour and minute so I want to change it. Not extract details out of it. Please help or at least give me another solution. Answer The CONVERT fun…
How to use order by after group by sql
I have a table like this: and I need to group by and order on positionNr. I tried with this query: But I obtain something like this: But what I want is a result like this: Please can you help to understand where is the problem on the query? Answer Based on your expected result, it seems that: 1- You
Replace comma separated list stored in database
I have a table with a field named Schedule with data type varchar(20) that currently holds a comma separated list of up to six (6) two (2) character schedule codes. Theses codes range from [a1-a9]-[g1-…
Find a list of all suppliers with orders from more than 615 different customers. Should return supplier name and customer count
Tables: Supplier: S_SUPPKEY, S_NAME Customer : C_CUSTKEY, C_NAME Orders : O_ORDERKEY, O_CUSTKEY Lineitem : L_ORDERKEY, L_SUPPKEY In the Lineitem table, there are many columns with the same ORDERKEY, …
Return number of rows since last occurrence
I want to find the number of reports a user has submitted since a user last received a personalized response. The column response_type has 3 possible values: “No Response,” “Templated Response,” and “…
Conditionally use CASE…WHEN – Oracle SQL
I have two tables like so: tblOrders: OrderNo (pk), CurrentStepNo (fk) tblSteps: StepNo (pk), OrderNo (fk), StepName, StepType, StepStart, StepStop tblOrders contains tons of information about our …
ORA-00903: invalid table name when selecting from USER
I have a task of connecting to a legacy Oracle 9i database and validate users with the new ERP, however when I try to run the query, I get ORA-00903: invalid table name This is the naive query I am …
SQL Query: Constructing a Control Group
I have two data sets. The first data set contains two (uniquely) identifying characteristics – here ZIP and race – as well as a variable called count. The second data set contains information on …
How to get stored procedure with transaction to execute if else code block?
I have stored procedure that takes multiple parameters. Based on parameters values either Insert or Edit process will be executed. In each process there are multiple Update/Insert statements (more …