I have a table name “Offers” with 3 (public, request, private ) types of data. Now I want to show directly to the user end public and request offers. and private offers not be shown but when admin …
LEFT JOIN ON string match Very slow
I have to perform this LEFT JOIN but it’s very slow (30.000ms) because of the match on text string. How can I make it faster? SELECT * FROM table_a LEFT JOIN table_b ON ( table_b.state = ‘…
How to get occupation of a month?
I have a reservation system but now I want to calculate what the occupation of a room in a month is. But I’m having trouble with getting accurate results because if a reservations start date is at f….
Bizarre Oracle Error: ORA-00936: missing expression
I’m working with a large, complex query. I added a simple date filter to the WHERE clause, and now I get ORA-00936: missing expression Removing the rest of the query, and just selecting id with this single date filter still produces the error – so at least that narrows it down. Looking online, apparently this error is supposed to indicate
SQL Grand Total row from Multi table Select Query
I have been able to use the below SQL query to give me 4 rows of data SELECT ‘Sales Order ‘ as Type, Format(Sum(T1.C_NetAmountLessDiscount), ‘#.00’) As NetAmount, Format(Sum(T1.C_MarginAmount), ‘#….
group by issue in sql
i’m trying to get in a new column the sessions who are between 08:00 and 18:00. You can see my last CASE in the CTE. For each date there should be a new column “TotalRestrictedSessions” which indicate how many session were on that particular date. If there are none, in this case i have to write 0. I suspect that
SQL request for a JSON file
I am using node-red and influxDB with it. Basically I am running node-red (which execute a python code), with node-red I am getting a data from gauge strain cell, and I have them with a json format as …
Query for array values within jsonb column
I have a jsonb column called chores in my work table with data looking something like this: [{“task”: “feed_dog”, “value”: “Daily”},{“task”: “mop_floor”, “value”: “Weekly”] There could be zero to dozens of tasks in the chores array for each user. How can I query by task name? For example, pull all records where at least one task is feed_dog. SELECT chores->>’task’
Most performant way to filter on multiple values in multiple columns?
I have an application where the user can retrieve a list. The user is allowed to add certain filters. For example: Articles: 123, 456, 789 CustomerGroups: 1, 2, 3, 4, 5 Customers: null ArticleGroups: null … When a filter is empty (or null), the query must ignore that filter. What is the most performant way to build your query so
SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens – help needed
I’ve tried making a website which has a database connected to it and I’m getting the error message below SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens This is my PHP code that I have written below Answer It took me a while to find, but I believe that PDO::prepare passes the named parameters