i have a table student like
sname
-----
ram
ram
ram
raj
raj
raj
i need the output like
sname
-----
ram
raj
ram
raj
ram
raj
Answer Posted / praveend
This query ill run on MySQL
CREATE TABLE IF NOT EXISTS `stu` (
`id` int(5) DEFAULT NULL,
`sname` varchar(20) DEFAULT NULL
)
INSERT INTO `stu` (`id`, `sname`) VALUES
(1, 'ram'),
(2, 'ram'),
(3, 'ram'),
(4, 'raj'),
(5, 'raj'),
(6, 'raj');
ANSWER
select sname from (
select (id- round((select count(*)from stu)/2)) as id, sname from stu where id >((select count(*)from stu)/2)
UNION
select * from stu where id<4
) as B order by(id)
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
How to download and install sql server 2005 books online?
How many triggers you can have on a table?
What are the difference between data mart and data warehouse? : sql server analysis services, ssas
Is the log file is a part of file group?
What do we have to check in database testing?
What is dimension table? : sql server analysis services, ssas
How can you tell if a database object is invalid?
Please differentiate between a local and a global temporary table?
What is transactional replication?
Difference between LEN() and DATALENGTH() in sql server ?
What is the syntax for encrypting a column in SQL Server?
What is temporary table in sql server? Why we use temp table?
What are the built in functions in sql server?
What does Master database contains?
Why would you call update statistics?