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.
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 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 5 years ago.
Improve this question
I'm trying to solve this problem. But I have difficult working with dates, dates overlapping, whatever.
I would like to get all events that was happening in March, 2007.
My events table:
ID
name
start_date
end_date
I am trying:
SELECT *
FROM events
WHERE (MONTH(start_date)<=3 AND
YEAR(start_date)<=2007) AND (YEAR(end_date)>=2007 AND
MONTH(end_date)>=3)
Can you help me?
Normally, you would use:
where start_date < '2007-04-01' and end_date >= '2007-03-01'
This will give any event active during the month.
If you want events that are only in the month, then:
where start_date >= '2007-03-01' and end_date < '2007-04-01'
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
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