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;
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 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;
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
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 5 years ago.
Improve this question
What is the use of DESC command in SQL?
"desc" by itself isn't a command. I suppose you mean "ORDER BY field DESC"
the "desc" means that the results obtained from the query will be showed in descending order.
Example:
Suppose you have a bills table with an id field and a total of 5 rows in that table. Those five rows have id: 1 (row 1), 2 (row 2) and so on. Well with a query of this type:
SELECT id FROM bills ORDER BY id DESC
You will get as query result:
5
4
3
2
1
Why? because you asked for descending order in the query instruction (from highest number to lowest number) in this case.
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.
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, '%')