General question about specific SQL problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • André Lagerburg
    New Member
    • Jan 2011
    • 1

    General question about specific SQL problem

    Hello,

    I can usually find answers to my own question on the web but in this case I don't know where to look.

    Asume I have a simple table 'Fruit' with the fields fruit and cost. Asume it is filled like:

    Apple, 0,44
    Orange, 0,69
    Banana, 0,51

    Now I want to put together baskets. Let's make 2 of them with the following content:
    'For lunch' with 1 apple and 1 banana
    'With extra vitamines' with 1 apple and 2 oranges.

    What single query is able to produce the following simple output:

    For lunch, 0,95
    With extra vitamines, 1,82

    The idea is to have this in a View so that I can select from this output for other purposes.

    Thanks in advance,

    André
  • ck9663
    Recognized Expert Specialist
    • Jun 2007
    • 2878

    #2
    Why not create a table named Basket<sequence > (the sequence should make it unique. Or you can name it LunchBasket. Then just do an inner join with your Fruit Table.

    Happy Coding!!!

    ~~ CK

    Comment

    Working...