QUERY TWO VIEWS

  • I have two views that i need to get some info from

    I need a query that give the following results:

    item, description, qty, and the cost

    here is the vies:

    vPickDetails(customer_number,company_name,item_number,description,picked_quantity,creation_date)

    vInventoryCost(inventory_id,quantity,item_number,description,cost)

    will this query work

    select dbo.vPickDetails.item_number,dbo.vPickDetails.description,dbo.vPickDetails.picked_quantity,cost

    FROM dbo.vPickDetails,dbo.vInventoryCost

    WHERE dbo.vPickDetails.item_number = dbo.vInventoryCost.item_number

    AND dbo.vPickDetails.description = dbo.vInventoryCost.description;

  • laparicio (5/7/2011)


    I have two views that i need to get some info from

    I need a query that give the following results:

    item, description, qty, and the cost

    here is the vies:

    vPickDetails(customer_number,company_name,item_number,description,picked_quantity,creation_date)

    vInventoryCost(inventory_id,quantity,item_number,description,cost)

    will this query work

    select dbo.vPickDetails.item_number,dbo.vPickDetails.description,dbo.vPickDetails.picked_quantity,cost

    FROM dbo.vPickDetails,dbo.vInventoryCost

    WHERE dbo.vPickDetails.item_number = dbo.vInventoryCost.item_number

    AND dbo.vPickDetails.description = dbo.vInventoryCost.description;

    Ideally, it should work but in real world it does n;t seem so. By the way why are you comparing description column ?

    i personally think that you could do a join only on item_number . Do you have many-to-many cardinality ratio between the view data. I mean to say , do you multiple rows with same item_number in both the views?

    Regards,

    Sachin

  • well we bought this software Inventory control and this is the database that came with it.

    thanks

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply