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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T01:52:39+00:00 2026-06-18T01:52:39+00:00

For example we have this 2 tables table1: Dir_num | dir_name 10 | john

  • 0

For example we have this 2 tables

table1:

Dir_num |  dir_name
10      | john
11      | vlad

table2:

game    |  dir_num
101     | 10
111     | 10
102     | 11
104     | 10
104     | 10

Now I try to find the dir_name who has less than 2 games played.

select * from table1 where dir_num  ....

Please help me find pl/sql code.

The output should show

 Vlad.
  • 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-18T01:52:41+00:00Added an answer on June 18, 2026 at 1:52 am

    Try something like this — use GROUP BY and HAVING:

    SELECT t.dir_num, t.dir_name
    FROM Table1 t
      LEFT JOIN Table2 t2 ON t.dir_num = t2.dir_num
    GROUP BY t.dir_num, t.dir_name
    HAVING COUNT(DISTINCT t2.game) < 2
    

    And here is the SQL Fiddle.

    If you want those in both tables (meaning at least 1 game), then change LEFT JOIN to INNER JOIN.

    Good luck.

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

Sidebar

Related Questions

I can only explain this with an example. I have 2 tables ( table1
say for example i have a tables called table1 and table2; table1{q_id,q_text,date}, table2{a_id,q_id,a_text} I
In this example we have 3 related tables on a SQLite database: CREATE TABLE
Rails noob here. I have a rails application with (in this example) three tables.
I have 3 tables Table1 (with 1020690 records), Table2(with 289425 records), Table 3(with 83692
I have three tables (these are the relevant columns): Table1 bookingid, person, role Table2
I have three tables table1, table2 and table 3. I am getting data to
I have 2 tables: Table1 = names of gas stations (in pairs) Table2 =
I have two tables Table1: ColumnA (varchar) Table2: ColumnB (varchar) I need to get
for example if you have this rows create table table1 ( column1 int primary

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.