urgent...please help with code

J

Joey Martin

Please, please help with me with this code. I thought I had it figured
out, but no such luck.

I have two tables, raceresultsview and jockeyselections.

In jockeyselections, I have jockey names and stableid, for example Pat
Day, stableid 1000.
In raceresultsview, I have jockey names, and placement.

I want to do something like this:
select * from raceresultsview where jockey in (select jockey from
jockeyselections). This works FINE, but I need to figure out how to grab
the stableid, too.

Each time there is a match, I want to insert the stableid and placement
into the table named winnings.

How do I get this to work?
 
D

dlbjr

INSERT INTO matches ( JockeyId, StableID )
SELECT jockeyselections.JockeyID, jockeyselections.StableID
FROM jockeyselections INNER JOIN raceresultsview ON
jockeyselections.JockeyID = raceresultsview.JockeyID;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top