| | |
View Help
Please support our MS SQL advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Oct 2009
Posts: 1
Reputation:
Solved Threads: 0
In the view below, I need the line "isnull(wwr.packed_qty, isnull((select sum(qty_on_hand) from lot_loc where item = coi.item and loc like 'P%'), 0)) packed_qty, " to include a "or 'S%'", so that both P and S are found, but I get a syntax error when I add it.
What is the correct syntax that I am missing?
This is what I used isnull(wwr.packed_qty, isnull((select sum(qty_on_hand) from lot_loc where item = coi.item and loc like 'P%' or 'S%'), 0)) packed_qty, and got the syntax at 'or' error.
Below is the whole "Current" view.
What is the correct syntax that I am missing?
This is what I used isnull(wwr.packed_qty, isnull((select sum(qty_on_hand) from lot_loc where item = coi.item and loc like 'P%' or 'S%'), 0)) packed_qty, and got the syntax at 'or' error.
Below is the whole "Current" view.
MS SQL Syntax (Toggle Plain Text)
CREATE VIEW [dbo].[SII_vwYardsOnHandDueRpt] AS SELECT isnull(wwr.greige_item, (SELECT top 1 item FROM item WHERE family_code = 'GREIGE' AND coi.item LIKE item.item + '%')) greige_item, isnull(wwr.greige_yds, 0) greige_yds, isnull(wwr.finished_item, (SELECT top 1 item FROM item WHERE family_code = 'FINISHED' AND coi.item LIKE item.item + '%')) finished_item, isnull(wwr.finished_yds, 0) finished_yds, isnull(wwr.packed_item, coi.item) packed_item, isnull(wwr.packed_desc, it.description) packed_desc, isnull(wwr.packed_qty, isnull((SELECT sum(qty_on_hand) FROM lot_loc WHERE item = coi.item AND loc LIKE 'P%'), 0)) packed_qty, isnull(wwr.pack_uom, it.u_m) pack_uom, coi.co_num, coi.co_line, coi.co_release, coi.due_date, (coi.qty_ordered - coi.qty_shipped) * dbo.SIIItemSalesUOM2(coi.co_num, coi.co_line, coi.co_release) qty_due, coi.u_m sales_uom, ca.[name] customer_name, dbo._SIIQtyDueInYards(coi.co_num, coi.co_line, coi.co_release) qty_due_yds FROM coitem coi WITH(NOLOCK) INNER JOIN item it WITH(NOLOCK) ON it.item = coi.item LEFT OUTER JOIN co WITH(NOLOCK) ON co.co_num = coi.co_num LEFT OUTER JOIN custaddr ca WITH(NOLOCK) ON ca.cust_num = co.cust_num AND ca.cust_seq = co.cust_seq LEFT OUTER JOIN SII_vwWipWebReport wwr ON wwr.packed_item = coi.item WHERE co.stat IN ('O', 'S') AND coi.stat IN ('O', 'S')
Last edited by Ezzaral; Oct 28th, 2009 at 3:51 pm. Reason: Added [code] [/code] tags. Please use them to format any code that you post.
![]() |
Similar Threads
- View other's desktop (Networking Hardware Configuration)
- help with SQL query / view / count problem.... (MS SQL)
- How to Set Default View & to Open in Same Folder (VB.NET)
- Can't view source codes (Web Browsers)
- View Source in IE6 (Web Browsers)
Other Threads in the MS SQL Forum
- Previous Thread: how can i find the table names
- Next Thread: MS SQL: Converting row printing to column based printing
Views: 316 | Replies: 1
| Thread Tools | Search this Thread |
Tag cloud for MS SQL
"last age autogrowth business connectingtodatabaseinuse count cursor data database dateadd datediff datepart day" dbsize deadlock delete_trigger exploit getdate hack highperformancecomputing hpc hpcserver2008 ibm iis limit live loop maximum microsoft ms mssql multiple multithreading news number password permission position query reporting result security server services sets single source sql sql-injection sqlserver sqlserver2005 subtype supercomputing supertype tables uniqueid update view weekday






