SELECT match_id AS m1
FROM `match_info`
ORDER BY match_id =18 DESC
Subscribe to:
Post Comments (Atom)
Popular Posts
-
1. How old PHP language is? - PHP began in 1994, so 14 years old. 2. What are different names of PHP? - PHP originally stood for Persona...
-
HTML: a. HTML is a markup language that is used to build static (non interactive and nonanimated) webpages. b. HTML is Case-Insensitive. So...
-
A payment gateway is an e-commerce application service provider service that authorizes payments for e-businesses, online retailers, bricks...
-
Note : This is not a perfect sort order, we have just displaying the list of PHP companies. 1. Photon Infotech No. 2/102, Arvind IT Park (N...
-
- count() -- Count elements in a variable - syntax for count() [int count ( mixed var [, int mode])] - If the optional mode parameter is set...
-
Hai all, Simple show hide sample using Show/Hide? Simple Show/Hide code
-
Sharing PHP, MySQL, Javascript, CSS Knowledge, We can share our PHP knowledge on the basis of PHP versioning, Javascript, AJAX, Stylesheet, ...
-
Use the below code and you can get the exact value in php as us saw in browser. Code: $encode_data = iconv('UTF-8', 'windows-125...
-
Download and Enjoy!
-
A hyperlink is a text or a image that you can click on, and move from one page to another web page. Syntax: < a href= "web pag...
7 comments:
The Sharing PHP Knowledge blogspot seems to be too good for sharing individual ideas.
I would suggest you to kindly give more user friendly discussions
say for e.g., "Complicated Queris In MSQL" -- title is good.
1. Need some description for the query that's written.
2. Explanation of the query in brief what it does
etc.
Note: I didn't mean to give for each and every post. Only for Complicated logic.
Regards
GIRISHANKAR R
hai giri,
you are abolutely right, in some difficult scripts should need a minimal discription,
actually how the query is,
SELECT match_id AS m1
FROM `match_info`
ORDER BY match_id =18 DESC
in this query "match_id=18" is given in the ORDER BY because when we need to fetch the "match_id=18" as the first record, then we can write the query like this and rest of the records in the table "match_info" are fetched as 2nd , 3rd and etc records ..
Your friendly,
manoilayans
Hai all,
SELECT *
FROM `zen_tax_rates`
ORDER BY tax_rates_id = (
SELECT tax_rates_id
FROM zen_tax_rates
WHERE tax_description
LIKE '%sample%'
LIMIT 1 ) ASC
by this query the selection field value in the ORDER clause is chosen by dynamic using the WHERE clause value and ASC is used here because the selection value is need to be displayed as last record in the fetch. If we want to display the selection record need to be displayed a first record in the fetch we need simply to put DESC in the ORDER BY in this query.
Regards,
yourfriend
What a query? i have surprised when i was looked this query!!!!!!!
Amazing!!!! I m very feel to say this.. what can i do ?
Hello PHP guys, plz look at this query, Definitely u have gathering lot knowledge....What a thinking
Sample Queries given by Kamaldassan, SDI, MySQL Guru 1. To show the firstname, middlename, lastname as a fullname
SELECT CONCAT (`first_name`, ' ', `middle_name`, ' ', `last_name`) AS fullname FROM `student_users` ORDER BY fullname ;
2. Add 31 days to the date
SELECT ADDDATE( '1998-02-28', INTERVAL 31 DAY ) OR
SELECT ADDDATE('1998-01-02', 31);
3. Add Time
SELECT ADDTIME('01:00:00.999999', '02:00:00.999998');
4. Differentiate two dates
SELECT DATEDIFF('1997-12-31 23:59:59','1997-12-30');
5. Extract the year from date
SELECT EXTRACT(YEAR FROM '1999-07-02');
6. Return as time for the given second
SELECT SEC_TO_TIME(2378);
7. Find the age
SELECT name, birth, CURDATE(), (YEAR(CURDATE())-YEAR(birth)) - (RIGHT(CURDATE(),5) < RIGHT(birth,5)) AS age FROM pet ORDER BY name;
8. Find name starts with either of the following words ex: b or s or p
Now we want to select the persons with a last name that starts with "b" or "s" or "p" from the "Persons" table.
SELECT * FROM Persons WHERE LastName LIKE '[bsp]%'
The result-set will look like this:
P_Id LastName FirstName Address City
2 Svendson Tove Borgvn 23 Sandnes
3 Pettersen Kari Storgt 20 Stavanger
Get next top value in a field.
If a field having the values with prefixed by "CAT" ex: CAT1, CAT45 etc.
SELECT max( cast( substring( categoryid, 4 ) AS decimal ) ) +1
FROM `category`
This query split the "CAT" and find the next top value.
Post a Comment