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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T17:47:37+00:00 2026-06-01T17:47:37+00:00

I am trying to make a query for SQL Compact It is basically these

  • 0

I am trying to make a query for SQL Compact

It is basically these queries, but I was hoping I could combine them into one.

1.

SELECT schoolId,opponent 
FROM TEAM_SCHEDULE
WHERE seasonId = " & i & "
AND gameid = " & currentGame & "
ORDER BY id"

These are variables, trying to eliminate them at some point
currentMatch(0) = schoolId
currentMatch(1) = opponent

2.

SELECT id
FROM player
WHERE school = " & currentMatch(0) & "
AND starter = 'TRUE'
AND game_id = " & currentGame & "
ORDER BY weight

3.

SELECT id
FROM player
WHERE school = " & currentMatch(1) & "
AND starter = 'TRUE'
AND game_id = " & currentGame & "
ORDER BY weight

I was thinking I could do something like this, but I ran into a problem trying to figure out how to add the two schools to the query.

        cmd.CommandText = "SELECT b.id, player.id" &
                            " FROM player b" &
                            " WHERE player.school = " & currentMatch(0) &
                            " OR player.school = " & currentMatch(1) &
                            " INNER JOIN player" &
                            " ON b.weight = player.weight" &
                            " ORDER BY player.weight"

To hopefully clear up any confusion, I am trying to:

  1. Select 2 schools(int) from team_schedule, schoolId and opponent.
  2. Select all starters(‘True’) at every weight from both of those schools.
  3. Pair up the starters from each school according to weight.
  4. Be able to select each pair and manipulate the data.

Appreciate any help!

This is the parsing error from your query Nikola,
Error

  • 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-01T17:47:38+00:00Added an answer on June 1, 2026 at 5:47 pm

    This might be your query. You can state the same table more than once, but you need to provide different alias to each one. In this case player is listed twice as p1 and p2. Match on players weights is also done in join part, but it might be in where clause.

    SELECT 
      schoolId,
      opponent, 
      p1.id Player1, 
      p1.Weight Player1Weight, 
      p2.id Player2, 
      p2.Weight Player2Weight
    FROM TEAM_SCHEDULE
    inner join player p1
       on TEAM_SCHEDULE.schoolId = p1.school
     and TEAM_SCHEDULE.GameID = p1.Game_id
     AND p1.starter = 'TRUE'
    inner join player p2
       on TEAM_SCHEDULE.opponent = p2.school
      and TEAM_SCHEDULE.GameID = p2.Game_id
      AND p2.starter = 'TRUE'
    -- tricky part - do weights match perfectly 
    -- or do you need additional weight range table?
      AND p1.weight = p2.weight
    WHERE TEAM_SCHEDULE.seasonId = " & i & "
    AND TEAM_SCHEDULE.gameid = " & currentGame & "
    ORDER BY id
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to make a sql query following these rules: basically i have
We're currently stuck trying to make a simple (?) SQL query. We have these
I am trying to make a query to an SQL database and I can't
I'm trying to make a query, but I can't find a way to do
I'm trying to make a Teradata SQL query that will return the n -th
I'm trying to make a query that grabs a single row from an SQL
I am trying to make some sort of SQL Query where I only get
I am trying to write a sql query but i find some difficulties.What i
I have question about the sql query. I am trying to make the query
I am trying to make an sql query to subtract two values from different

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.