11,469 questions
-1
votes
0
answers
123
views
Use of named parameters in MySQL subquery with PHP8 [closed]
I have 2 tables customers and addresses (each customer can have many addresses)
The customers table has two fields of interest:
userName (varchar)
userID (varchar)
The addresses table has two fields ...
2
votes
1
answer
83
views
PostgreSQL correlated query ignore WHERE clause [duplicate]
For each customer_id, I want to find the first delivery order. For each row of Delivery, I compare order_date with the smallest order_date of that customer_id.
Why does the SELECT statement below only ...
-1
votes
1
answer
53
views
MS Access 2016 Subquery
I have gone all around the houses with this trying to use a subqueries etc but just cannot get this to work and I am thinking it should be easy. So this is what i have:
SELECT DISTINCT Register....
1
vote
1
answer
76
views
MariaDb Use Column In primary Query in sub Query
I have a table that has store names, product codes and prices.
I need to pull the minimum price of a product and display a list of the product codes with their minimum price, where it all falls down ...
-5
votes
1
answer
100
views
Filter table using result from another Select [closed]
I want to query table2 to get results having field field_b which corresponds to the first query result's list. (More as a LIKE; the comparison won't match perfectly).
I have a table with many fields, ...
1
vote
3
answers
137
views
Case of null value based on key column when returning rows without a certain match in another table
The employee table lists the employees and the history table records hire and term dates as separate rows.
I need to write a query that identifies all employees from the employee table that are ...
-1
votes
1
answer
58
views
Linking union query to subquery
I'm trying to write a query that will join a subquery with a large union query and I'm having some trouble.
Below is the subquery:
SELECT DISTINCT X.JOB, FOO.PART FROM
(SELECT C.PART, C.ORDER_NO, C....
-2
votes
1
answer
69
views
Wordpress Subquery returns more than 1 row for query plugin delete users by role and date [closed]
I work on this plugin for Wordpress to delete users with a subscriber role and 30 days since joining us; users are active or not.
I cannot correct this error after activating.
if ( !defined('ABSPATH') ...
-3
votes
1
answer
60
views
error 1046 in subquery inserting data from specific columns to another table [closed]
I am trying to copy a few fields of video information from one MariaDB table to another using a subquery, decoupling some video info from a classified ads table for later refactoring.
video:
id (int ...
0
votes
1
answer
73
views
Delete (or Select) data with subquery using T-SQL
I am trying to come up with T-SQL query to delete data based on these conditions:
Find data that have same Email.
If that user has both AllLocations 'Yes' or 'No', delete entry/entries that are not ...
-2
votes
1
answer
67
views
Why is my SQL subquery returning an error in PostgreSQL when comparing salaries? [closed]
I'm trying to retrieve employees who earn more than the department's average salary using a subquery in PostgreSQL.
SELECT
employee_id,
first_name,
salary
FROM
employees e
WHERE
e....
1
vote
0
answers
107
views
Snowflake: "Unsupported subquery type cannot be evaluated" when using a function with a subquery on a JSON column
In Snowflake I'm trying to de-identify data stored in a JSON column based on configurations in a separate table. I created a custom SQL function DEIDENTIFY_JSON which uses a subquery to look up the de-...
-1
votes
2
answers
89
views
How to delete a row knowing its row index in a nested SQL statement where the table doesn't have a row index column?
My app has a function that deletes a specific row in a SQLite table based on the row index or position, but the table doesn't have a column that stores a row index for easy access. My app retrieves ...
-1
votes
1
answer
57
views
I'm trying to replace not exist in with left join, but my query is not returning the same result
so I'm trying to using left join instead using not exist (which I always disliked), but somehow I'm not getting the same result.
Original query that returns the correct result:
select o.number, o....
-2
votes
4
answers
146
views
Select where x is true but not y [closed]
I have a table that stores customer transaction data. I want to select all customers that have purchased item 1 (64244), but remove/ignore them from the results once they've purchased item 2 (64270). ...