Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6894333
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:46:10+00:00 2026-05-27T06:46:10+00:00

I have a doubt in writing sql. I had a farmerfields table with YEAR,SEASON,Number

  • 0

I have a doubt in writing sql.

I had a farmerfields table with

YEAR,SEASON,Number of Fields.

and season look like this

Kharif---- 15june-15Oct   
Rabi---15 oct to 15 Feb   
Summer----15Feb to 15 June 

now i want to write sql which returns all the rows excluding the current season in the current year. ie we should get the current season based on system date.

I am cracking my brain to get this, but could not.

Please help me.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T06:46:11+00:00Added an answer on May 27, 2026 at 6:46 am

    Your table structure is wrong and not fit for what you need.

    Instead of single field called SEASON, have two fields: SEASON_START and SEASON_END both of type Date then the query is as simple as:

    Select * From [farmerfields] Where GetDate() Between SEASON_START And SEASON_END
    

    If the names are part of your current SEASON field, add third field SEASON_NAME as well and the new structure will be:

    SEASON_NAME | SEASON_START | SEASON_END
    ---------------------------------------
    Kharif      | 15june       | 15Oct   
    Rabi        | 15 oct       | 15 Feb
    ...
    

    Edit: in my above sample code I assumed you have SQL Server database – in case of different database you’ll have different function to get current system date.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ok, this is a doubt I always have when I'm writing any API, a.k.a.,
I have a doubt about orkut's new URL Writing method. Earlier the home page
I have little doubt about string reading in C. string reading functions like gets,
I got this doubt while writing some code. Is 'bool' a basic datatype defined
This question has been asked again and again, but I have still a doubt.
I doubt this is possible, but just wanted to confirm. I am writing a
Possible Duplicate: What is the difference between const and readonly? i have doubt in
I have a doubt: - Is there any standard/convention that when should I use
I have one doubt regarding casting. public void Test(out T a, out T b)
I have a doubt in layouts.I have designed one layout using group layout using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.