05-08-2008, 05:51 PM
|
#11 (permalink)
|
|
The Wanderer
Join Date: May 2008
Location: Beware of programmers carrying screwdrivers
Posts: 21
Thanks: 0
|
Ah, pretty much the way you did it...
Code:
SELECT column1, column2, column3
FROM table_name WHERE column4 = 'some value';
Multiple table queries would need aliases:
Code:
SELECT a.column1, a.column2, b.field1, b.field2
FROM table_name a
LEFT JOIN another_table b
ON (a.column3 = b.field3)
WHERE column4 = 'some value';
Count queries can use an alias, but the table doesn't need an alias:
Code:
SELECT COUNT(post_id) AS total_posts
FROM posts_table
WHERE post_time > 1207677000
Your assoc array would contain $array['total_posts'];
Though I would need to see your COUNT query to understand what you’re asking. :)
|
|
|