samedi 11 juillet 2015

Populating a third table from two other tables (blacklist and whitelist query) (sqlite)

i have two tables table a:

name  number  noOfcol  price  color

john  1       4        2      green
phil  2       3        2      blue
harry 3       2        5      green
jack  4       5        6      red
jill  5       1        4      red

table b:

localName  noOfcol  price  color

monster    2        4      blue

and i want table c to output:

localName  name  number

monster    harry 3
monster    jill  5

so whats happening here is that table c is taking those that are blue, and blacklisting them, and those that are not are blacklisted, then it makes sure that price is atleast the same or above the listed price in table b, and lastly it makes sure noOfcol is atleast the same or less. im having trouble creating a query that will do this for me. any pointer would be greatly appreciated. (i also plan on implementing this into to my java app, using netbeans, but for now a query is what im need of)

Aucun commentaire:

Enregistrer un commentaire