cnichols0021
New member
- Local time
- Today, 03:36
- Joined
- May 25, 2011
- Messages
- 1
Hey everyone - This is my first post, hope I get some advice from it! I've just started using Microsoft Access DB within the last month for work and I'm learning very fast (I think), but I'm still trying to understand the language. So, I've been doing side projects to practice.
Here is my issue - I like to play cards (blackjack in particular). I've created multiple tables (just named CARD1, CARD2, CARD3 etc.) with the fields: CARD1_ID, CARD1_NAME AND CARD1_VALUE. I have 56 rows (four extra rows because Ace's can be played as 1 as well as 11). I'm trying to query all the possible permutations (order does not matter). The problem is the query returns ACE CLUB, JACK CLUB and JACK CLUB, ACE CLUB (see below).
Do I have the correct table design?
Do I need multiple tables or can I generate the query off one table?
Whats wrong with my code?
I'm taking it slow, meaning I'm looking at all possible 2 card combinations, the 3 card combinations and so on...But if someone knows how to combine these into one query I'd like to see the code for it.
Here is my SQL view:
SELECT
CARD1.CARD1_NAME,
CARD2.CARD2_NAME,
CARD1_VALUE+CARD2_VALUE AS [TOTAL VALUE]
FROM
CARD1,
CARD2
WHERE CARD1.CARD1_NAME<>CARD2.CARD2_NAME
AND
CARD1_VALUE+CARD2_VALUE="21"
Here is whats returning (sorry it didnt copy/paste like expected):
SINGLE DECKCARD1_NAMECARD2_NAMETOTAL VALUEACE CLUB10 CLUB21ACE HEART10 CLUB21ACE SPADE10 CLUB21ACE DIAMOND10 CLUB21ACE CLUBJACK CLUB21ACE HEARTJACK CLUB21ACE SPADEJACK CLUB21ACE DIAMONDJACK CLUB21ACE CLUBQUEEN CLUB21ACE HEARTQUEEN CLUB21ACE SPADEQUEEN CLUB21ACE DIAMONDQUEEN CLUB21ACE CLUBKING CLUB21ACE HEARTKING CLUB21ACE SPADEKING CLUB21ACE DIAMONDKING CLUB2110 CLUBACE CLUB21JACK CLUBACE CLUB21
THANKS!!!
Here is my issue - I like to play cards (blackjack in particular). I've created multiple tables (just named CARD1, CARD2, CARD3 etc.) with the fields: CARD1_ID, CARD1_NAME AND CARD1_VALUE. I have 56 rows (four extra rows because Ace's can be played as 1 as well as 11). I'm trying to query all the possible permutations (order does not matter). The problem is the query returns ACE CLUB, JACK CLUB and JACK CLUB, ACE CLUB (see below).
Do I have the correct table design?
Do I need multiple tables or can I generate the query off one table?
Whats wrong with my code?
I'm taking it slow, meaning I'm looking at all possible 2 card combinations, the 3 card combinations and so on...But if someone knows how to combine these into one query I'd like to see the code for it.
Here is my SQL view:
SELECT
CARD1.CARD1_NAME,
CARD2.CARD2_NAME,
CARD1_VALUE+CARD2_VALUE AS [TOTAL VALUE]
FROM
CARD1,
CARD2
WHERE CARD1.CARD1_NAME<>CARD2.CARD2_NAME
AND
CARD1_VALUE+CARD2_VALUE="21"
Here is whats returning (sorry it didnt copy/paste like expected):
SINGLE DECKCARD1_NAMECARD2_NAMETOTAL VALUEACE CLUB10 CLUB21ACE HEART10 CLUB21ACE SPADE10 CLUB21ACE DIAMOND10 CLUB21ACE CLUBJACK CLUB21ACE HEARTJACK CLUB21ACE SPADEJACK CLUB21ACE DIAMONDJACK CLUB21ACE CLUBQUEEN CLUB21ACE HEARTQUEEN CLUB21ACE SPADEQUEEN CLUB21ACE DIAMONDQUEEN CLUB21ACE CLUBKING CLUB21ACE HEARTKING CLUB21ACE SPADEKING CLUB21ACE DIAMONDKING CLUB2110 CLUBACE CLUB21JACK CLUBACE CLUB21
THANKS!!!