[Impressum/Imprint] [Kontakt/Contact Me]
Home Working with TNG's SQL-based Reports (A Guide to my Report Library) Some More SQL Tips & Tricks VIEW-based TNG reports
 TNG - Tips & Tricks
 Working with TNG's SQL-based Reports (A Guide to my Report Library)

Understanding SQL Select Statements

Here is an easy example:

SELECT personID, lastname, firstname, birthdate, birthplace FROM tng_people WHERE lastname LIKE "M%" ORDER BY lastname, firstname, birthdatetr;

This SQL statement gives a list of a people having last names starting with "M".

  Explanation
SELECT
personID, lastname, firstname, birthdate, birthplace Names of the data fields we want to see. Each data field gives a column in the resulting table.
FROM  
tng_people The database table where data coming from.
WHERE  
lastname LIKE "M%" We don't want to see all data – we want only the data according to this condition (last names beginning with "M").
ORDER BY  
lastname, firstname, birthdatetr the data fields to get the resulting table sorted
; each SQL statement ends with a semicolon.

Modify this example on our own and see what happens!


Copyright © http://www.ahnendaten.de/tng/
Letzte Aktualisierung am 11. Juni 2017

Home Working with TNG's SQL-based Reports (A Guide to my Report Library) Some More SQL Tips & Tricks VIEW-based TNG reports