Jump to content

Problem Using AS when there is a function


will35010

Recommended Posts

I'm having a problem with this query and using AS. I'm using this query to export to excel so I want to use AS on the FROM_UNIXTIME functions so the user doesn't see that. I tried enclosing the function into parenthesis, but that didn't work. How do I make it work? Thanks!

 

$select = "SELECT (patients.lname) AS LastName, (patients.fname) AS FirstName, (patients.dob) AS DOB, (patients.sex) AS Sex,
(visit_data.cc) AS ChiefComplaint, FROM_UNIXTIME(visit_data.reg_time), FROM_UNIXTIME(visit_data.discharged_time), (visit_data.disposition) AS Disposition, (visit_data.leftby) AS LeftBy 
FROM patients, visit_data WHERE discharge_date = '$date' AND patients.patientid = visit_data.patientid";

In other words how do I make this work

 

SELECT FROM_UNIXTIME(visit_data.reg_time) AS RegistrationTime FROM visit_data;

 

I tried

SELECT (FROM_UNIXTIME(visit_data.reg_time)) AS RegistrationTime FROM visit_data;

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.