SQL Server Performance

pls provide query for this!

Discussion in 'Getting Started' started by sundarsrini_s, Jun 2, 2008.

  1. sundarsrini_s New Member

    select min(dbo.FS_ItemInventory.Bin) from(SELECT MIN(dbo.FS_LotTrace.LotNumber),dbo.FS_ItemInventory.Bin FROMdbo.FS_LotTrace RIGHT OUTER JOIN dbo.FS_MOHeader AS h INNER JOINdbo.FS_MOLine AS l ON l.MOHeaderKey = h.MOHeaderKey INNER JOINdbo.FS_Item AS i ON i.ItemKey = l.ItemKey INNER JOINdbo.FS_MOLineData ON l.MOLineKey = dbo.FS_MOLineData.MOLineKey LEFT OUTER JOINdbo.FS_DemandSupply AS ds ON l.MOLineKey = ds.TopLevelDemandSupplyKey LEFT OUTER JOINdbo.FS_ItemInventory RIGHT OUTER JOINdbo.FS_Item AS di ON dbo.FS_ItemInventory.ItemKey = di.ItemKey on ds.DemandItemKey = di.ItemKey ondbo.FS_LotTrace.LotTraceKey = dbo.FS_ItemInventory.LotTraceKeywhere (dbo.FS_ItemInventory.InventoryCategory!='H' or dbo.FS_ItemInventory.InventoryCategory is null) group by di.ItemNumber,dbo.FS_ItemInventory.Bin)
    when i tried this query,i get a error likeIncorrect syntax near ')'
    pls provide the correct query for this.
  2. Adriaan New Member

    For each ( character you must also have a ) character.
  3. Luis Martin Moderator

    Adriaan, to me match. (or I'm blind)[:)]
    But I can't find the problem.
  4. Adriaan New Member

    Luis, no of course you're not blind, perhaps I am ... Problem is that the derived table does not have an alias. It has to have one!
  5. Luis Martin Moderator

    Thanks Adriann, I can see now.

Share This Page