How to get customize date format in mysql [closed] - mysql

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 a column named timee and data type is timestamp and the default value is current_timestamp.
My table looks like
id title timee
1 Abc 2020-10-31 00:31:47
2 Def 2020-10-31 00:35:50
I want to fetch data like
id title timee
1 Abc 31-10-2020
2 Def 31-10-2020
I tried select id,title,time from tableName but it's giving me the whole time but i don't know how to select just date and with dd-mm-yyyy format

Use date_format():
select id, title, date_format(timee, '%d-%m-%Y') timee
from mytable

Related

Find the max name [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 need to find the sum of the names and then choose the bigger.
I need to show that the max name is John smith because it's 4 times.
I guess you need the most repeated name. You may try below query -
SELECT writer, COUNT(*)
FROM YOUR_TABLE
GROUP BY writer
ORDER BY COUNT(writer) DESC
LIMIT 1;

SELECT mysql query to get first 100 numbers (1-100) [closed]

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 2 years ago.
Improve this question
i want a mysql select query where i can get first 100 numbers starting from 1 and ending to 100 without CTE or any procedures just want a query only.
When I need a list of integers I use
SELECT help_keyword_id num
FROM mysql.help_keyword
HAVING num BETWEEN 1 AND 100
ORDER BY 1;

count all records columns with value 0 or 1 in mysql/php [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 6 years ago.
Improve this question
Please help me friends. I have attached a screenshot of my table I wish to count all columns with value 0 or 1 where buno="$busno".
Sorry But I don't have any code. I have database table and I don't know how to query at such condition. In the table you can see fields busno with seat A1,A2,A3,A4,B1,B2......N1,N2,N3 and N4. They have only 2 values 1 and 0. 0 for vacant and 1 for booked. I wish to find out how many seats are left (in numbers like 10 0r 20) for a particular busNo. Are you getting my problem?
Get the result row in PHP with the query buno = "$busno", and iterate resultset in php and count the number you want.

MySQL - Return Distinct Rows and Count of their Duplicates [closed]

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 8 years ago.
Improve this question
MySQL isn't my strong suit, can someone recommend an efficient query for pulling all distinct values from a column and counting all duplicates of each distinct value?
So for example the following table
s_ip
---------
10.1.25.4
10.8.25.8
10.1.25.4
10.1.25.4
10.8.25.8
10.1.48.1
10.1.25.4
Would return
s_ip | Count
----------|------
10.1.25.4 | 4
10.8.25.8 | 2
10.1.48.1 | 1
Thanks in advance
SELECT s_ip , COUNT(*) as count FROM table_name GROUP BY (s_ip)
select
s_ip, count(*) as `count`
from table
group by s_ip
DEMO

MYSQL SUM Value [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 8 years ago.
Improve this question
I have 2 table :
table structure for "kegiatanrenja"
idkegiatan tahun koderekening detail
renja001 2001 1.03.03.04.1 A
renja002 2001 1.03.03.03.2 B
renja003 2001 1.08.08.05.3 C
renja004 2001 1.08.08.05.2 D
table structure for "sumberdana"
idkegiatan nilai kodesumberdana
renja001 100 1
renja002 200 2
renja003 50 1
renja004 100 1
I want to create a query that displays the value of all the columns "nilai" if MID (koderekening, 9,2) the same value, along with the value of another column, where each row in the group by where each row in the group by MID (koderekening, 9,2).
kode rekening nilai_group(SUM Of value the same kode MID(koderekening,9,2)
1.03.03.04 300
1.08.08.05 150
please help, every suggestion will be very appreciated.
SELECT LEFT(koderekeneing,0,10), sum (nilal)
FROM kegiatanrenja k
JOIN sumberdana s ON s.idkegiatan = k.idkegiatan
GROUP BY MID(koderekening,9,2)
UNION
SELECT 'ALL', sum (nilal)
FROM kegiatanrenja k
JOIN sumberdana s ON s.idkegiatan = k.idkegiatan
Please note, this is VERY easy, so if you are asking this sort of question on stack lot, you are going to receive a negative response. Please get yourself a good SQL book and do some studying.