472,333 Members | 1,103 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,333 software developers and data experts.

SELECT query to find max

kiss07
99
Hi,

i have a table emp:

empid
ename
deptid
joined_date
are the columns.

empid ename dept joined-date
------------------------------------------------------------------------------
101 arun cd2 12-APRIL-2007.

102 kumar mec 30-APRIL-2007.

103 DEBAS cs3 13-APRIL- 2007.

104 MUKIL HR 11-MARCH-2007.

109 DEAR ER4 11-APRIL- 2007.

900 SATHYA PER 30-JAN-2007.

303 KING FORCE 22-APRIL-2007.

i want to select april month maximum employees are joined.


expecting output:

month count
------- ----------
APRIL 5

PLS hepl anybody..

Arunkumar..
May 5 '07 #1
2 2643
frozenmist
179 Expert 100+
Hi,

i have a table emp:

empid
ename
deptid
joined_date
are the columns.

empid ename dept joined-date
------------------------------------------------------------------------------
101 arun cd2 12-APRIL-2007.

102 kumar mec 30-APRIL-2007.

103 DEBAS cs3 13-APRIL- 2007.

104 MUKIL HR 11-MARCH-2007.

109 DEAR ER4 11-APRIL- 2007.

900 SATHYA PER 30-JAN-2007.

303 KING FORCE 22-APRIL-2007.

i want to select april month maximum employees are joined.


expecting output:

month count
------- ----------
APRIL 5

PLS hepl anybody..

Arunkumar..
Expand|Select|Wrap|Line Numbers
  1.  
  2. select mon as  " MONTH" , cnt as "COUNT"  from 
  3.  
  4. (select count(*) cnt,to_char(joined_date,'MONTH') mon 
  5. from emp 
  6. group by to_char(joined_date,'MONTH') 
  7. order by cnt desc ) 
  8.  
  9. where rownum=1
  10.  
hope this answers ur question.
Cheers
May 5 '07 #2
debasisdas
8,127 Expert 4TB
HI Arun

If u want to find out in which month maximum employees joined the company the below query in the previous will do the trick for u.
May 5 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

21
by: John Fabiani | last post by:
Hi, I'm a newbie and I'm attempting to learn howto create a select statement. When I use >>> string1='18 Tadlock Place' >>>...
4
by: Denis St-Michel | last post by:
Hello All, Hope some Guru will be able to help me with this. Let's take this example table A...
2
by: phpuser32423 | last post by:
Hi everyone Is it by any chance possible to use mysql and php to auto create the content for drop-down lists on forms by retrieving the values...
10
by: serge | last post by:
Using "SELECT * " is a bad practice even when using a VIEW instead of a table? I have some stored procedures that are identical with the...
3
by: Tcs | last post by:
My backend is DB2 on our AS/400. While I do HAVE DB2 PE for my PC, I haven't loaded it yet. I'm still using MS Access. And no, I don't believe...
23
by: Brian | last post by:
Hello All - I am wondering if anyone has any thoughts on which is better from a performance perspective: a nested Select statement or an Inner...
5
by: parwal.sandeep | last post by:
Hello grp! i'm using INNODB tables which are using frequently . if i fire a SELECT query which fetch major part of table it usually take 10-20...
1
by: JC | last post by:
Hello, I am trying to change a select, find duplicates, query into a delete query. I want to get rid of the records in the main table...
22
by: MP | last post by:
vb6,ado,mdb,win2k i pass the sql string to the .Execute method on the open connection to Table_Name(const) db table fwiw (the connection opened...
1
by: zafm86 | last post by:
Hi everyone! I'm sure my problem is pretty easy to solve but I've been working on it for a long and my my brain is not working correctly anymore....
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.