it is possible to get only one row per record in a multitable query?
I have this three tables:
APPLES
ID | APPLE
----------
1 | RED
2 | YELLOW
3 | GREEN
FARMS
ID | FARM
--------------------
B1 | GEORGE'S FARM
B2 | JOHN'S FARM
FARM_APPLES
FARM | APPLE
---------------
B1 | 1
B1 | 2
B1 | 3
B2 | 1
B3 | 3
With this tables I need this result:
FARM_NAME | APPLE_1 | APPLE_2 | APPLE_3
----------------------------------------
B1 | 1 | 2 | 3
B2 |1 | | 3
Any help is much appreciated, thanks in advance.
EDIT
Thanks both OMG Ponies and Bill, I'll try both of your solutions, just one last thing, its possible to get this result:
FARM | RED | YELLOW | GREEN
-------------------------------------
GEORGE'S FARM | YES | YES | YES
JOHN's FARM | YES | NO | YES
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…