1

Is there any way to search two tables in one query?

I have two tables:

sarcshiftcentertable
id
startdate
enddate

sarcshiftpointtable
id 
startdate
enddate
point_id 

I want to search these two tables, like combining them but not horizontally, vertically.

I want to select the startdate and the enddate from these two tables in one query. Is this possible? If so, how can I do it?

hichris123
  • 10,145
  • 15
  • 56
  • 70
  • What have you tried? Your question is a little hard to understand, but it sounds like you might want to look into the `UNION` keyword. – Chris Shain May 27 '14 at 01:13

1 Answers1

0

Try this query :

SELECT id, startdate, enddate , '-' AS point_id 
FROM sarcshiftcentertable 
WHERE startdate >='2014-05-27'
AND enddate <='2014-06-27'
UNION
SELECT id, startdate, enddate, point_id 
FROM sarcshiftpointtable 
WHERE startdate >='2014-05-27'
AND enddate <='2014-06-27'
BAdmin
  • 927
  • 1
  • 11
  • 19