Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
Below is my database table.
what will be the sql query to calculate average score of all topic1 entries,of all topic2 entries and so on with where clause(where event_date between this to this)?
use group by
select topic_name, avg(score)
from my_table
where event_date between '2016-03-01' AND '2016-03-31'
group by topic_name
Related
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 2 years ago.
Improve this question
I have this kind of code
SELECT MONTH(date_entered) AS Month,sex, COUNT(*) AS Customer
FROM customer
GROUP BY month
ORDER BY Month
I want to split sex (M and F) for each month. But the result that I get combine both sex
You need to include sex in group by as well
SELECT
MONTH(date_entered) AS Month,
sex,
COUNT(*) AS Customer
FROM customer
GROUP BY
MONTH(date_entered),
sex
ORDER BY
Month
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 3 years ago.
Improve this question
i have table like this
date , N°ProDUCT , QUANTIE_SELL
every day i sell pruduct
N°pruduct------quantite_sell
i want to show eatch pruduct with the sum of the quantite ?
exmpl :1----82
2-----70
3-----12
the sql statment ??
Write the below query :-
SELECT SUM(quantite_sell) from product GROUP BY Nprod;
Thanks
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
In my table, there is one filed named "Reporting_Date". And I want to get Weekday name of all dates from table. Weekday like sunday, monday. How does it possible in mysql?
Use DAYNAME(date)
https://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_dayname
mysql> SELECT DAYNAME('2007-02-03');
-> 'Saturday'
SELECT DAYNAME(Reporting_Date) FROM <table_name> WHERE 1
I guess you could model date format according to your requirements.
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 8 years ago.
Improve this question
I have table orders(id, buyerEmail, paymentTime, finalPrice)
Mysql query to list customers purchase worth more than 50 million in the previous 3 months from 31.01.2014?
SELECT buyerEmail
FROM orders
WHERE paymentTime BETWEEN '2014-01-31' - INTERVAL 3 MONTH AND '2014-01-31'
GROUP BY buyerEmail
HAVING SUM(finalPrice) > 50000000
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 8 years ago.
Improve this question
I need to show the month with the highest number of quantity sold.
I don't know how to do that. Please help thank you.
I have:
id, prod_name, price, q_sold, month
the q_sold must sum up with the number of month input.
You can order your result by the sum and take only the first entry with limit 1
select `month`, sum(q_sold) as sold_sum
from your_table
group by `month`
order by sold_sum desc
limit 1