Cancelado

Write SQL statement

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.

Habilidades: SQL

Ver mais: find the words and write, sql less than, write com, write some sql for a project, utilizing, sql, sql based, statement structure sql, sql optimize, filed, simple write, simple sql statements, standalone data, simple data structure project, data structure simple project, database broken, data write, sql simple project, standalone database, project based sql, simple project sql, signal project, simple database structure, standalone project, simple sql

Acerca do Empregador:
( 149 comentários ) Platte City, United States

ID do Projeto: #569482

2 freelancers estão ofertando em média $335 para este trabalho

BestWeb4U

We are group of highly motivated people having about 8 years of consolidated experience in the area of web design and development. We strongly believe in process and quality and religiously follow the same. We have goo Mais

$420 USD in 5 dias
(6 Comentários)
4.2
crispymasala

**************************************** Dear Customer, An exciting proposal is waiting for you in the PM. Please manage some time to check the PM from us. *********************************** Regards, Crispy

$250 USD in 0 dias
(1 Comentário)
1.8