All Questions
140,464
questions
0
votes
0
answers
12
views
SQL Inner join with where clause works fast with one condition, but not when activeFlag is added
I have a query like
select C.customerId, C.firstName, C.LastName, R.IsActive from
Customer as C
Inner join Rider as R ON R.customerId = C.customerid
where R.rideid = 'xyz' and
R.rideareacode = 'abc' ...
0
votes
2
answers
40
views
Select user's high score for each lesson from one table based upon lesson ids in another table
I have a site that has multiple courses and each course has multiple lessons. I would like to select the highest score per LESSON for a given user_id and course_id ordered by lesson_order.
TABLE ...
-2
votes
0
answers
21
views
insert in to target table and avoid the rows with same set of column value from source to target [duplicate]
-- Create a temporary table with sample data
CREATE TEMPORARY TABLE temp_student (
roll_no INT,
name VARCHAR(50)
);
-- Insert some sample records into the temporary table
INSERT INTO ...
0
votes
0
answers
36
views
How to Use a Single INSERT INTO Statement for Multiple Rows in Python?
I’m currently working on a Discord Python bot where I loop through a list of ForumTags and generate an INSERT INTO SQL statement for each object to insert data into a MySQL database.
However, I want ...
0
votes
2
answers
46
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
...
3
votes
0
answers
60
views
Bottom-up tree structure cumulative sum
entityid
parentid
emission
E1
E2
541
E2
E4
272
E3
E4
270
E4
NULL
362
I have the above tree structure, my goal is to calculate the cumulative sum of each node, with weighted contribution from the ...
0
votes
2
answers
52
views
Sum values between a lot of date-ranges in a single column
I'm trying to figure out how to get a sum of value by transaction dates over a 90 day period and repeated over a single year's worth of transaction dates.
This is what I have
transaction_date
value
...
2
votes
2
answers
63
views
How can I set a numeric wildcard in MySQL? [duplicate]
I'm trying to create a SQL script that finds codes in two different databases. I want to set a parameter that has a numeric wildcard.
Codes are often written like this for example, ABC108, ABC109, ...
-2
votes
0
answers
39
views
is there a way to store unschematised datas in sql database [closed]
mysql : 5.6 java : 11
Am in need of an mechanism to store unschematised data in my db. the case is as follows.
Objective :
To get all user from a 3rd party app and store it in db.
Problem facing :
...
0
votes
2
answers
34
views
Weighted hierarchical cumulative sum
I don't know if I'm using the correct terminology, but I'm trying to find the cumulative sum of each node in a tree structure, but the children node only contribute a percentage of its cumulative sum ...
-3
votes
0
answers
25
views
What is the best way to implement these relations in DB? [closed]
Movie
Stores:
Title
Description
Potentially huge text with a detailed description of the movie
Budget
Release date
Duration
Character
Stores:
Name
Description
Role (Valid values — leading, ...
-3
votes
0
answers
19
views
Error Code: 1242. Subquery returns more than 1 row WON'T BE ABLE TO DELETE EITHER OF THEM AS IT IS MY UNIVERSITY ASSESSMENT [duplicate]
NSERT INTO PLAYERS (PLAYER_ID,FIRST_NAME, LAST_NAME, GENDER)
VALUES ((SELECT PLAYER_ID FROM PLAYERS_NEW WHERE FIRST_NAME_X = 'ADELINA' AND LAST_NAME_X = 'DRAGONSCREAM' AND GENDER_X = 'F'),"...
-3
votes
0
answers
31
views
Associate multiple columns to one code ID MYSQL [duplicate]
I have two tables.
One called datospaciente and another called inventario
datospaciente has 10 columns: material1, material2 to ... material10. Each one has a code for equipment (values such as 123, ...
0
votes
0
answers
9
views
MySQL Password Not Working using Homebrew [duplicate]
I've been using homebrew to start and stop MySQL, but, it randomly stopped working, and keeps giving the acess Denied for User 'root'@'localhost' (using password: YES).
I'm 100% sure the password is ...
-1
votes
2
answers
59
views
i want to display old orders first from orders table based one company and followed by another company like wise [closed]
+----------+------------+
| id | name |
+----------+------------+
| 1 | storeone |
| 2 | storetwo |
| 3 | storethree|
+----------+------------+
+----------+---...