I’m looking to create a Postgres query based on a few user select params. A user will select a shop and a start and end year. Once submitted I’m would only like to display average prices of items if …
How to select a row who has a substring
I have and data like : ID term score 1 enthusiastic 0.986 2 excellence 0.984 3 loves 0.984 4 inspirational 0.984 5 proud 0.68 6 love 0.90 7 so proud 0.71 8 so so proud 0.90 I want to get a score …
SQL NOT IN or NOT EXISTS statement inefficient
Background I have two tables – one is updated each day with new data (failed deadline) and one is continually added and deleted from dependent on the other (live table). The way it works is that if …
Split multiple values in a cell to multiple rows – Oracle SQL
I have a table: table1 values ———— x=new letter ———— a=old letter ba=older letter xq=newer letter ———— xf=new apple xt=new orange x3=new fruit xtt=new seed I have to …
Sql Subselect ORA-00918
This is my Sql: SELECT t.RUFNAME, count(v_anschrift.rufname) as Anrufe FROM v_termin, ( SELECT RUFNAME FROM V_Anschrift WHERE V_ANSCHRIFT.SPERRKZ = 0 AND …
Compare two columns with ‘LIKE’ Operator in SQL / Laravel
I’m trying to compare two columns from a table. In which i have to check the email is containing his mobile number or not. TableName:- Table1 TableColumns:- id,email,MOB Ex. SQL: ‘SELECT * FROM …
SQL Server select parts, fill with 0 no result
I have the following tables Location (Id, locationName) Inventory (productid, qty, locationid) With the following data, I need to query to show all locations per productid, even when not in …
Return opposite transaction value rows
I have this table structure and I want a query that needs to be returning opposite side columns values. If I pass parameter with value Overtime then it should return following rows The logic is against each transaction if the selected Account is on Debit side it should print the Credit side accounts and if th…
How to avoid adding duplicate foreign key constraints
I would to know if it is possible to avoid adding several times the same foreign key constraint? Example: if I execute 3 times the query below, the constraint will exist with 3 times in phpmyadmin… It would be great that it would be rejected the second and third time I apply that query. Answer You can g…
Updating each column on schedule by values from another column
I have a users table and two columns are having a relationship. The value of the first column is the monthly deductions of each user. I want the data in the first column to keep auto increasing …