Skip to content
Advertisement

Tag: date

mysql get result from join table

I have a tables person and exam. I want to show data where all exam is PASS, show the latest exam pass_date. like table below what query to get it? please help. thanks! Answer You can use aggregation and conditional expressions: Note that for this sample data, you don’t need to bring in the person table to get the results

select current address

I am new in sql and have a table as folow: patientid |gender|yearbirth|zipcode|admission | ———–|——|———|——-|——————-| P1213060727|w | 1926|55268 |2017-01-23 16:28:00| P1213060727|w | 1926|55270 |2018-09-26 18:10:00| P1213060729|w | 1956|55262 |2018-03-09 09:51:00| P1213060731|m | 1935|55276 |2015-02-11 16:54:00| P1213060762|w | 1945|55452 |2011-01-19 15:30:00| Some person have two address and I need the list of patients with the current address. patientid |gender|yearbirth|zipcode| ———–|——|———|——-| P1213060727|w

Get List of Last 15 Days Date in SQL

Could SQL get list of date of last 15 days date in a single query? We can get today date with select current_date() We also can get last 15 days date with select date_add(current_date(), -15) But how to show the list of last 15 days date? For example the output is Answer In Hive or Spark-SQL: Result: See also this

Advertisement