Select * from table T where T.ssn IN (...arraylist...) - How to do this
From: ragnart (member44594_at_dbforums.com)
Date: 10/17/03
- Previous message: Kathy Benson: "Re: MSSQL JDBC with J2SE 1.4.1 ??"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 17 Oct 2003 06:24:18 -0400
Hi, I have a quick question I hope someone can help me with. I'm a
student and what I'm looking for should be easy but I can't find any
information on it.
Here's my code, it's probably self-explanatory but to clarify I'm trying
to get a list of "Captains" in the order of who has the most wins.
The problem is that the database tables have thousands of "Captains" and
I'm only supposed to look at 200 specific "Captains" which have their
ssn in a specific arraylist and then return the top 80 "Captains" from
that selection.
Everything's written in Java and SQL.
If you have any thoughts on this I would be most grateful.
------------------------------------------------------------------------
-
SELECT first 80 E.name, L.ssn, COUNT(L.wins) as Wins
FROM log L, employees E
where type matches "[Captain]"
and E.ssn = L.ssn
and L.ssn IN (...arraylist...) // How do I loop through the arraylist
but still return a list of the top 80 winners?
group by E.name, L.ssn
order by Wins desc;
------------------------------------------------------------------------
-
Many thanks,
sincerely,
ragnart
-- Posted via http://dbforums.com
- Previous message: Kathy Benson: "Re: MSSQL JDBC with J2SE 1.4.1 ??"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]