Project Detail

TSQL stored procedure  

TSQL stored procedure is project number 294594
posted at Freelancer.com. Click here to post your own project.

 

| More Free Trial For New Buyers
 

Status:

Selected Providers: indradj

Budget: $30-250

Created: 08/01/2008 at 2:19 EDT

Bid Count: 3

Average Bid:
N/A

08/02/2008 at 2:19 EDT

Project Creator: Ruilong
Employer Rating: 10/1010/1010/1010/1010/1010/1010/1010/1010/1010/10 (26 reviews)

Bid On This Project
 

Description

I need a stored procedure (T-SQL, MSSQL 2005) that returns a list of availible addresses from a database.

buy_orders_pallets (table 1) (contains what clients want to buy)
bid int <- passed as parameter to SP
pid int
amount int
isdry bit

customer_avi (table 2) (contains what clients want to sell)
pid int <- pallet id
aid int <- address id (This is what I want returned)
amount int
isdry bit


Here is the two tables, I want a SP that takes 1 parameter (bid) as input. use this bid to get rows from table 1
Then return all address id (aid) from table 2 where
ALL of the following criteria is met.
1. all pid from table 1 is inside table 2 (matching the aid)
2. amount is equal or greater in table 2 than in table 1
3. isdry is equal


Example data below would on input bid= 1 return values 1 and 4

Table 1
bid pid amount isdry
1 1 5 true
1 2 7 false
1 5 2 true

Table 2
pid amount isdry aid
1 10 true 1
2 7 false 1
5 2 true 1

1 150 true 2
5 20 true 2

1 110 true 3
2 70 true 3
5 21 true 3

1 15 true 4
2 75 false 4
5 21 true 4

Job Type

See more: address, bid, data, list, pid

Messages Posted:0 View project clarification board Post message on project clarification board

Bid On This Project
 

If you are the project creator or one of the bidders Log In for more options

Bids are hidden by the project creator. Log in as the project creator or as one of the bidders to view bids. You will not be able to bid on this project if you are not qualified in one of the job categories. To see your qualifications click here.


    Bid on this Project