• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 256
  • Last Modified:

How would I use PHP to run two different type mysql querys and display the results in the same table ?

I need to run the two query's below and than echo the results as one table. Can anyone tell me how ? What I need to do is show along side the meter_date field the number of days it has been from today's date that it was last updated.
SELECT To_days( meter_date ) - TO_DAYS( last ) FROM `meter`


SELECT * FROM meter WHERE hub > 1 AND service_type ='Wet' ORDER BY meter_date DESC, unit ASC

Open in new window

0
GD_GRAY
Asked:
GD_GRAY
1 Solution
 
nemws1Database AdministratorCommented:
How about doing the calculation along with the select:
SELECT meter.*, TO_DAYS(meter_date)-TO_DAYS(last) AS last_meter_update
FROM meter
WHERE hub > 1
  AND service_type = 'Wet'
ORDER BY meter_date DESC, unit ASC
;

Open in new window


Although I think you want your date calculation to be:
TO_DAYS(NOW())-TO_DAYS(meter_date)

Open in new window

0
 
GD_GRAYAuthor Commented:
Thank you...
LoL and yes your right, I did want the calculation the other way. You have a wonderful Christmas..
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now