Skip to content

Tag: mysql

MySQL get the SUM of different currencies

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

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 …