
December 30th, 2012, 06:40 AM
|
|
Contributing User
|
|
Join Date: Mar 2012
Posts: 55
Time spent in forums: 10 h 40 m 30 sec
Reputation Power: 2
|
|
assuming you just want the data that there's an entry for in both tables, it should be something like this:
Quote: Select * from tag
join serialnumber on tag.serialnumberid = serialnumber.id and and serialnumber.modelid = 80
where
tag.created BETWEEN '2012-09-01' AND '2012-12-29'
and tag.tagtype <> 'service' |
if you also want the tags that have no matching serialnumber, you would use Left Join.
If you also want the serial numbers that have no corresponding tags, you would use Right Join
|