Find the max name [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 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;

Related

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;

How to get customize date format in mysql [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 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

Mysql Order By(sorting data) opposite gender first then same gender etc [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
I want to sort users data according to multiple column's like
1. opposite gender then same gender
2. same city
3. same interest
select * from table where status=1 ORDER BY gender = '".$gender."' DESC, city = '".$udata['city']."' DESC, total_rcv_kisses DESC, interest IN ('".$udata['interest']."') ASC, age ASC limit ".$limit.",".$start;

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.

Select Where Result Is In String [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 7 years ago.
Improve this question
I would like to perform a SQL Select Statement where any text in the query is a result.
For example, if the query is 'Driving Directions to Dundee in Scotland' I want this result to be returned
id: 5
name: Dundee
description: Dundee is a City in Scotland
Location: 56.4640° N, 2.9700° W
For your particular example, you could use this where clause:
where $query like concat('%', name, '%')