This project is to write a simple SQL statement. The data (and database structure) for the SQL statement is located at [url removed, login to view]
Basically, the SQL statement needs to return the signalid from the tradesignals database. The only variable that is passed in from the outside is the acct_id filed. It needs to have the following criteria:
1. The lowest signalid needs to be found for a given account id where the cmd is less than 6 and the same signalid is not already inserted into the usersignalx table for the given account id and there is no associated signal (found by associating the signalid field in the first record with the assoc_signalid field in the second record) where the cmd in the second record is equal to 6 or 7.
2. The lowest signalid needs to be found where the cmd is 9 and the signalid is not already inserted into the usersignalx table for the given account id.
3. The lowest signalid is found where the cmd = 6, 7, or 8 and there exists a corresponding record (linked by signalid = assoc_signalid) where the record for the assoc_signalid is in the usersignalx for the passed in acct_id. However, if the there exists a cmd = 6 or 7 for the same assoc_signalid, the cmd = 6 or 7 should be returned (lowest of them first is fine).
The lowest of 1, 2 and 3 should be returned in the statement, if possible.
In other words - some of the tradesignals are records on their own, and some later ones are associated to an earlier signalid (based on the assoc_signalid). The goal is to find the lowest standalone one (with a cmd of less than 6) that is not already recorded by the user (thus in the usersignalx) or find the > 6 < 9 signalid records that the user already recorded.
The goal is to write efficient SQL, but if the SQL statements need to be broken up, then that is okay.
Speed is important as well as utilizing the proper keys. Make sure the database structure has the keys defined to optimize the SQL statement. No database or structure modifications should be made (besides key recommendations).
12 freelancers are bidding on average $53 for this job
Hello, We have 9+ Yrs of experienced in .NET /PHP [url removed, login to view] did 200+ Web /Desktop [url removed, login to view] have 5 yrs Experieced (SQL SERVER) DB [url removed, login to view]
Will give you with in hours, i am pretty much confident on giving finetuned SQL statement on your [url removed, login to view] you need me please shoot PM. thx for your time.