SQL Samples

Mindwatering Incorporated

Author: Tripp W Black

Created: 10/12/2010 at 02:19 PM

 

Category:
Notes Developer Tips
LSX (LotusScript Extensions/Connectors)

Simple selection that get's all from a table/view named "mytable":
SELECT* FROM mytable

Simple selection that reformats a date:
SELECT DATE_FORMAT(mydate, '%M %e %Y') AS mydate FROM yourtablename;
(Note: the results here would ONLY contain that date column)

Simple selection that returns the 'nm_first' field and the 'date_start' fields from a table/view called 'employee':
SELECT nm_first, DATE_FORMAT(date_start, '%d-%m-%Y') AS 'date_start' FROM employee

Selection asking for only documents after a certain date and with a certain status flag:
SELECT acct_mgr, DATE_FORMAT(book_date, '%m/%d/%Y') AS book_date, status, cust_nm, contact_id, contact_firstnm, contact_lastnm, event_date, facility_id, facility_nm, facility_city, facility_state, facility_zip FROM view_booking WHERE event_date >'2010-01-01' AND status !='cancelled'


previous page