Click here to Skip to main content
15,919,028 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a table in Oracle database(karno,year,month)

What I have tried:

I want to write a query to shows me list of kar that among within a month for example( month=1,month=3, month=5, month=7, month=9, month=11)
Posted
Updated 12-Apr-17 10:55am
v3
Comments
CHill60 12-Apr-17 5:51am    
So you want to write a query. What have you tried? Where are you stuck? How are we supposed to help you without any sample data or a proper description of the problem?
faridehkalantary 19-Apr-17 0:58am    
I have a table with columns(karno, year, month)... i want show a list of records that gives the list every other month for example records(karno) that give lists mounh=1 and month=3 and month=5, month=7, month=9,month=11
thanks for you
CHill60 19-Apr-17 4:08am    
I've updated my solution.
faridehkalantary 26-Apr-17 6:33am    
thanks alot for you
Bryian Tan 12-Apr-17 16:56pm    
What is Karno and kar means?

1 solution

For want of more information, try this
SQL
SELECT year, month, count(*)
FROM yourTable
WHERE month IN (1,3,5,7,9,11)
GROUP BY year, month
If you want to list the actual records then do this instead:
SQL
SELECT karno, year, month
FROM yourTable
WHERE month IN (1,3,5,7,9,11)
ORDER BY month, karno
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900