View Single Post
Old 02-14-2013, 08:03 PM   PM User | #3
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,187
Thanks: 59
Thanked 3,995 Times in 3,964 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
Code:
SELECT stories.give, stories.list, stories.of, stories.fields, categories.wanted
FROM stories INNER JOIN categories
ON stories.catid = categories.catid
WHERE categories.name LIKE '%racing%'
  AND stories.name LIKE '%racint%'
Or use an "implicit join", thus:
Code:
SELECT stories.give, stories.list, stories.of, stories.fields, categories.wanted
FROM stories, categories
WHERE stories.catid = categories.catid
  AND categories.name LIKE '%racing%'
  AND stories.name LIKE '%racint%'
And/or use aliases on your table names to make shorter queries, thus:
Code:
SELECT S.give, S.list, S.of, S.fields, C.wanted
FROM stories AS S, categories AS C
WHERE S.catid = C.catid
  AND C.name LIKE '%racing%'
  AND S.name LIKE '%racint%'
Or or or or ...
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is offline   Reply With Quote
Users who have thanked Old Pedant for this post:
Oatley (02-15-2013)