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 8041021
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T04:04:45+00:00 2026-06-05T04:04:45+00:00

I have two tables. First Table is a batch table that contain comma separated

  • 0

I have two tables. First Table is a batch table that contain comma separated student id in field “batch”

batch
--------------
id      batch 
--------------
1       1,2     
2       3,4

Second Table is marks

marks
----------------------
id  studentid   subject     marks
1     1         English     50
2     2         English     40
3     3         English     70
4     1         Math        65
5     4         English     66
6     5         English     75
7     2         Math        55

How we can find those students of first batch id =1 who have scored more than 45 marks in English without using sub query.

Problem i found to get this done using a single query is that we can not use IN as an association operator in JOIN statement

What changes are required in below query to make it work?

SELECT * FROM batch
INNER JOIN marks ON marks.studentid IN(batch.batch) where batch.id = 1
  • 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-05T04:04:47+00:00Added an answer on June 5, 2026 at 4:04 am
    SELECT  m.studentId
    FROM    batch b
    JOIN    marks m
    ON      FIND_IN_SET(m.studentId, b.batch)
            AND m.subject = 'English'
    GROUP BY
            m.studentId
    HAVING  SUM(marks) > 45
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two tables with FIRST and SECOND id. <TABLE ID=FIRST> <TR> <TD></TD> <TD></TD>
I have two tables. First contain list of used words, second keep black list
I have two tables, the first table has the product and the second table
I have a script in MySQL that creates two tables, the second table references
I have two tables. First table have columns: price, code_one Second table has: code_one,
Lets say that I have two tables. The first is: table lists, with list_id
I have two tables. First table is users and second is datas . Datas
We have two tables. The first contains a name (varchar) field. The second contains
I have a database framework where I have two tables. The first table has
I have xpath page.search(//table[@class='campaign']//table) which returns two tables. I need to choose only first

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.