Showing posts with label orderid. Show all posts
Showing posts with label orderid. Show all posts

Friday, March 23, 2012

Help with a stored procedure

Is it possible to do something like this? I have all the records in #rsltTable (it has an Index and OrderID) I want to be efficient, so I am trying to use the OrderID's from #rsltTable to SELECT all of the records that I need to return. Right now I am getting "Msg 102, Level 15, State 1, Procedure pe_getAppraisals3, Line 119 Incorrect syntax near '>'."

SELECT * FROM Orders WHERE OrderIDIN(SELECT OrderIDFROM #rsltTableWHERE ID=> @.l_FirstRecordAND ID<= @.l_LastRecord)

IF you need more of the SQL I can post it.

Thank You,
Jason

Greater than or equal to is >=, not =>.

SELECT * FROM Orders WHERE OrderIDIN(SELECT OrderIDFROM #rsltTableWHERE ID>= @.l_FirstRecordAND ID<= @.l_LastRecord)

HTH,
Ryan

|||Last time I program after having teeth pulled...

Wednesday, March 7, 2012

help typical error inner join

hi, all

i am having what is considered to be typical error, i have two tables in sql2000 database

(options) orderid, productid, productname,optionvalue
(orderitems) orderid, quantity, unitprice,productcode,productid

I'd like to join these 2 tables and be able to display in a repeater. the problem is that i keep getting some duplicates with sql statement

"SELECT DISTINCT
options.orderid,options.productname,options.optionvalue,orderitems.quantity,orderitems.productcode
FROM options INNER JOIN on orderitems on
options.[orderid] = orderitems.[orderid] "

PLEEEASE HELP ME SLEEP AT NIGHT:)
thanksAdd this and remove the DISTINCT:

GROUP BY option.orderid, options.productname,option.optionvalue,orderitems.quantity,orderitems.productcode