In a MySQL database To get the SUM of a column I just do: Is it possible in only one SQL request to get the SUM of orderamount_total of the different curriences defined in the column currency? Answer You just need a group by
Tag: mysql
how to make search bar without having to type double quotation?
hello everyone i am trying to make this search bar in java but when i search without typing double quotation i get this error search error image but when i type numbers or words with double quotation it works just fine searching with double quotation image here is my code Code image ididn’t wirte anythi…
LEFT JOIN WHERE not returning results
There are two tables with columns and I’m doing a basic LEFT JOIN: Case 1 Result: All good! Case 2, applied on same records Result: I was expecting to return doe’s records but it returned nothing. What am I missing? Answer Ah, the wonderful world of NULL handling. The problem arises when doing a c…
avg value from a sql table
I have a MySQL table called track_e_exercises where is stored attempts in a test, every row is a new attempt. I want to know how to obtain the avg attempts in the course per person. How can I make that? c_id is the course id column and exe_user_id is the user id column. expected result for c_id=7 => (# of
Duplicates in pre-aggregated sub-query sql
I have two tables with many-to-many relationship. I am trying to get values from both of the table where UserId is unique (I’m joining these table on this value) I am rying to use pre aggregated query, but I get error Column ‘clv.ProbabilityAlive’ is invalid in the select list because it is …
What is the issue in below sql query? [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 1 year ago. Improve this question I am beginner in sql. Anyone please tell me the problem of my customised query. Error Code: 1…
mysql Duplicate entry error for primary key with similar values
This is how i created my table, i have composite key columns. now, im trying to insert this two values that are the same except for the last character ‘t’: value1 = testbtc:testusd value2 = testbtc:testusdt output error: it just makes no sense, they are not duplicated, is something missing on my t…
How does i/o on database relate to query type
So I have metrics that look like this. And here is my dumb question… Does the rw i/o directly correlate to rw query? Using the example below, does that mean there was increased read query activity? I don’t have some flags enabled yet to have metrics on the transaction level, but i’ll eventua…
Query to calculate “trailing twelve-month sum(column)” for 100s of dates in one query?
I have this table: Dividends History Table I’m trying to figure out the most efficient way to get: One row for each date Each row contains the sum(dividends_received_value) for the past year of data relative to the date in that row (“trailing twelve months”) Can this be done purely in SQL? I…
MySQL get attribute which is not present for all possible values of another attribute
Assume there is a table with columns fieldA and fieldB (Primary Key:fieldA, fieldB). A program keeps inserting entries to this table with the same fieldA value, say constant_for_A, and some arbitrary …