Posted inProgramming / Mysql / Mysqli / php

How to write SQL Sub Query in PHP with MySQLi

How to write SQL Sub Query in PHP with MySQLi

In this Post We Will Explain About is How to write SQL Sub Query in PHP with MySQLi With Example and Demo.Welcome on Pakainfo.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to SQL subquery with multiple results Example

In this post we will show you Best way to implement SQL Sub Query in PHP/MySQLi, hear for How to write subquery in FROM clause with Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

Creating Simple Database

CREATE TABLE `students` (
  `studenid` INT(11) NOT NULL AUTO_INCREMENT,
  `studentId` INT(11) NOT NULL,
  `student_post` VARCHAR(200) NOT NULL,
  `studregDate` datetime NOT NULL,
PRIMARY KEY(`studenid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

INSERT INTO `students` (`studenid`, `studentId`, `student_post`, `studregDate`) VALUES
(1, 1, 'jaydeep Gondaliya', '2018-09-13 08:00:00'),
(2, 1, 'Ankit kathiriya', '2018-10-19 13:30:00'),
(3, 1, 'krunal sisodiya', '2018-10-04 20:05:00'),
(4, 1, 'mayur dhameliya', '2018-10-02 15:10:00'),
(5, 1, 'hitesh dhameliya', '2018-10-15 07:40:00'),
(6, 1, 'chirag dethariya', '2018-09-20 23:00:00'),
(7, 1, 'vivek viradiya', '2018-10-04 01:00:00'),
(8, 1, '#vishal pandya', '2018-09-01 22:05:00');

Creating Simple Connection


Example 1 : table students order by studregDate asc


		
			
			
			
		
		

Example 2 : table students order by studregDate desc


		
			
			
			
		
		

Example 3 : table students order by studregDate desc limit 3


		
			
			
			
		
		

Subquery


		
			
			 
			
			
		
		

index.php





Simple SQL SubQuery using PHP with MySQLi




Simple SQL SubQuery in PHP as well as MySQLi

order by studregDate asc
StudentID Stud Text Stud Reg Date
order by studregDate desc
StudentID Stud Text Stud Reg Date
Simple order by studregDate desc limit 3
(order by studregDate desc limit 3) as subquery order by studregDate asc
StudentID student Stud Text Stud Date

You are Most welcome in my youtube Channel Please subscribe my channel. and give me FeedBack.
More Details……
Angularjs Example

Example

I hope you have Got What is MySQL WHERE Clause with Examples – AND, OR, IN, NOT IN And how it works.I would Like to have FeedBack From My Blog(Pakainfo.com) readers.Your Valuable FeedBack,Any Question,or any Comments about This Article(Pakainfo.com) Are Most Always Welcome.

I am Jaydeep Gondaliya , a software engineer, the founder and the person running Pakainfo. I'm a full-stack developer, entrepreneur and owner of Pakainfo.com. I live in India and I love to write tutorials and tips that can help to other artisan, a Passionate Blogger, who love to share the informative content on PHP, JavaScript, jQuery, Laravel, CodeIgniter, VueJS, AngularJS and Bootstrap from the early stage.

Leave a Reply

Your email address will not be published. Required fields are marked *

We accept paid guest Posting on our Site : Guest Post Chat with Us On Skype