Advertisement

08.03.2008 at 08:34AM PDT, ID: 23617267
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.7

I need help in inserting data into a table

Asked by yossikally in SQL Query Syntax, SQL Server 2005

Tags: , ,

Hi,

I am doing a basketball league simulation game.  
The 2 tables of interest for my question are
T_PLAYERTEAM - just a matching tables of team ID to player ID and
T_PLAYER - table of players

The rules are simple: at the onset each team must have 2 players at each position.
For all kinds of reasons, this condition is frequently not met, so I  am trying to write a stored procedure to rectify the situation.

Going through all 5 positions, First I find the teams that only have 1 player at position 1,which is easy:
select pt.teamid
from tk_playerteam pt
inner join t_player p on p.playerid = pt.playerid
where p.position = 1
group by pt.teamid
having count(*) = 1
but now for each one of these I have to randomally pick a player from the T_PLAYER table (must be unattached but that's not part of this question),  which I can do as follows:
select top 1 playerid as playerid
from t_player
where position = 1
order by newid()

but I have no idea how to combine the two results (teamid in the first, playerid in the second) and insert them into the PLAYERTEAM table
Start Free Trial
[+][-]08.03.2008 at 09:36AM PDT, ID: 22148042

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.03.2008 at 09:54AM PDT, ID: 22148092

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: SQL Query Syntax, SQL Server 2005
Tags: Microsoft, SQL Server 2005, SQL, T-SQL
Sign Up Now!
Solution Provided By: MuhammadKashif
Participating Experts: 2
Solution Grade: A
 
 
[+][-]08.03.2008 at 09:57AM PDT, ID: 22148101

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.03.2008 at 09:58AM PDT, ID: 22148105

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.03.2008 at 10:22AM PDT, ID: 22148172

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.03.2008 at 10:52AM PDT, ID: 22148258

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.03.2008 at 11:25AM PDT, ID: 22148338

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.03.2008 at 11:37AM PDT, ID: 22148368

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.03.2008 at 11:49AM PDT, ID: 22148399

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.03.2008 at 11:53AM PDT, ID: 22148410

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.03.2008 at 12:02PM PDT, ID: 22148446

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628