Wavetronix Command Translator (CMD-DT) - User Guide Manual de usuario Pagina 154

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 156
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 153
APPENDIX 153
Example
If TableOne and TableTwo both contain an “ID” column in addition to their other col-
umns, then the ID numbers can be matched up to determine how to connect the
records in TableOne with TableTwo without combining all possible records together.
You can now specify the query using the relationship between the two tables in a WHERE
clause. Since we now have two ID columns, we will reference the table names to dierenti-
ate between them as well as dene the relationship.
SELECT Two, Four, Six, Eight from TableOne, TableTwo
WHERE TableOne.ID = TableTwo.ID
is will create data rows containing only data from TableOne and TableTwo, which has
the same ID value.
Many tables may have a name column that has no relationship to name columns in other
tables. In situations where columns in multiple tables have the same name but don’t repre-
sent the same data, you will need to specify the table name before the column name in dot-
notation. If you are not specic, the database will not know which table you are referring to:
SELECT TableOne.Name, Six, TableTwo.Name, Eight from
TableOne, TableTwo
In this case, the resulting dataset will have two “Name” columns even though the data with-
in them will be dierent. For clarication, use the renaming method above to rename one
or both Name columns:
SELECT TableOne.Name as TableOneName, Six, TableTwo.Name
as TableTwoName, Eight from TableOne, TableTwo
You can also use an alias to save keystrokes if typing the full table name before each column
becomes cumbersome:
SELECT a.Name as TableOneName, Six, b.Name as
TableTwoName, Eight from TableOne a, TableTwo b
In this query, Six and Eight do not need table qualiers because there are only one instance
of those column names between both tables.
Vista de pagina 153
1 2 ... 149 150 151 152 153 154 155 156

Comentarios a estos manuales

Sin comentarios