Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 query returns nothing?!

Author  Topic 

jarv
Posting Yak Master

131 Posts

Posted - 2014-10-10 : 06:34:15
Hi,
I am trying to get a list of people in 2 tables, my SQL returns nothing but it should return something?! have I written it correctly?

SELECT
customers.firstname,
customers.surname,
customers.email,
messages.created

FROM `customers`
INNER JOIN `messages` ON customers.id=messages.customer_id

WHERE `messages.created` <= '2012-09-01 00:00:00'

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2014-10-10 : 06:37:05
[code]
SELECT
customers.firstname,
customers.surname,
customers.email,
messages.created

FROM customers
INNER JOIN messages ON customers.id=messages.customer_id

WHERE messages.created <= '20120901'[/code]

It should work, provided you have data satisfying WHERE clause

Harsh Athalye
http://in.linkedin.com/in/harshathalye/
Go to Top of Page
   

- Advertisement -