All Questions
11,742
questions
0
votes
2
answers
48
views
MergingTwo SQL Queries Select and Count in Single statement
I am Working on project, where I am using two queries to get the result i wanted to process.
Query 1
SELECT MID FROM PMS.MACHINE WHERE STATUS=1 AND MID !=0;
Query 2
SELECT MID,COUNT(STATUS) AS QUEUE
...
0
votes
2
answers
47
views
Exclude rows where column matches another column without subquery
I have a result set of parent categories and subcategories. I want to exclude all parent categories if a subcategory exists in the results.
What I would do is using a NOT IN in the query, but that ...
-1
votes
1
answer
25
views
Mysql select var if not null
Some of the fields (url, poster, page) are null in my table (because this value as added later). When selecting all with following query, I will get null for these fields (url, poster, page), while ...
0
votes
1
answer
50
views
MySQL: Use column data from other row in output row in same table
I have a table with categories and subcategories, linked together with column 'cat_parent' which has the parent category id in it.
When I search for something I would like the result to include its ...
0
votes
1
answer
44
views
indexing is not working properly after upgrade mysql 8.0.28
The issue is coming after up gradation of mysql 8.0.28. I have a table called user_products. When I run the EXPLAIN SELECT query on it, the possible keys identified are user_id, productId, status, ...
1
vote
3
answers
103
views
How to move the last row to the top in a table in MySQL?
I have a row in the following table which is the first row but added to the table at the end and now I'd like to modify the table in a way to show employee ids in order starting by number 1.
Issue:
(
...
0
votes
1
answer
41
views
I have a query that outputs 5-6 different counts with union statements. Is there a way I can add row labels to each one? [duplicate]
The code snippet looks like this
(select count)
union
(select count)
union
(select count)
union
(select count)
union
(select count)
And the output is:
Count
291
3563
44
1
246
8123.
Is there a way I ...
1
vote
1
answer
60
views
Using TABLE keyword to SELECT everything from vs SELECT * from table_name
I was going through Mysql Official documentation 8.0 and here Mysql Documentation 5.6.6 Using Foreign Keys I found that we can use TABLE keyword to select everything instead of using SELECT.
Can ...
0
votes
1
answer
60
views
Query, giving back string, even if SELECT statement is empty, is faulty
simple question, but no idea, how to fix it.
Following Query should give back "No values", if SELECT Part will return nothing. I will get error message:
[21000][1241] (conn=80188403) Operand ...
0
votes
4
answers
106
views
SELECT all the records in a table that have ALL the specified characteristics from another table
to be more specific, I have a table with a list of symptoms and a table with a list of diseases. I have also created a table to link a specific symptom to a specific disease. What I'm looking to do is ...
0
votes
1
answer
25
views
MySQL How to select value if ANY is present, or otherwise fallback to value if ALL match
Say I have these two tables
table REQUESTS:
ID_REQUEST
USER
1
Adam
2
Ben
3
Charlie
table REVIEWS:
ID_REVIEW
ID_REQUEST
REVIEW
1
1
APPROVED
2
1
APPROVED
3
1
DENIED
4
2
APPROVED
5
2
APPROVED
...
0
votes
1
answer
27
views
MYSQL - How to select a single row for a value that is contained between intervals specified in a specific field in the rows of the table?
My question is a bit tricky to formulate, I hope it has not been asked before.
I want to select ONE row (or the single field "code" of that row) of a table by an input value that I pass to ...
0
votes
3
answers
65
views
How to get each average of multiple items?
There is a table storing name, speed and timestamp of cars. Each car sends its speed at irregular time intervals, some send more often, some may have not sent their data for a couple of hours, ...
0
votes
1
answer
29
views
Unable to find solution for a certain sorting scenario
I have a scenario where I regularly need to maintain records in a table that defines workflow order definitions to add and remove stages which puts the IDs in a non-deal order (cant change the IDs ...
0
votes
0
answers
11
views
"HTML Form Select Tag Issue: Only First Word of Multi-Word Selections Inserted into MySQL Table" [duplicate]
A single HTML select tag is populated by a MySQL database table. When a user selects an option containing multiple words and submits it, only the first word of the selection is saved.
This is the code ...