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

  • Home
  • SEARCH
  • 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 8613429
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:52:24+00:00 2026-06-12T04:52:24+00:00

Firstly I am new to SQL, and I have trouble in setting up a

  • 0

Firstly I am new to SQL, and I have trouble in setting up a simple stored procedure. I am learning SQL and need some help here.

Scenario:

  • I have two tables, Fruits and Oranges

  • Fruits has the following columns

    • fruitId
    • fruitSeason
  • Oranges has the following columns

    • organgesId
    • fruitId
    • orangeName

I want to create a stored procedure to return all Fruits along with an extra column count, this count will be total number of fruits id in Oranges.

Thanks

  • 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-06-12T04:52:26+00:00Added an answer on June 12, 2026 at 4:52 am

    Try this:

    CREATE PROC ProcName
    AS 
      SELECT f.Id, f.fruitSeason, COUNT(g.fruitId) 'Total Fruits in Oranges'
      FROM @fruits f 
      LEFT JOIN @Oranges g ON g.fruitId = f.Id
      GROUP BY f.Id, f.fruitSeason
    

    Here is a live demo

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

Sidebar

Related Questions

see fiddle Firstly i am new to jquery. i have to make one cell
Firstly some background,.. IVe started a new job as PHP developer with a company
I'm pretty new to databases and sql. I have a problem where I have
Im very new to WP7 Development and i have a few questions. Firstly i
Since I am new to iOS development I have a few Questions. Firstly I
I am very new to Ruby, and programming in general. Firstly, I have the
Firstly, I'm rather new to SQL and I've run into a roadblock. I'm using
Firstly I'm a complete newbie when it comes to SQL Server. I have five
Firstly, I am new to both android and Java. I have two classes, my
Firstly, Im new to android but have years of various other programming experience on

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.