05-08-2008, 05:55 PM
|
#12 (permalink)
|
|
The Prestige
Join Date: Dec 2007
Posts: 1,044
Thanks: 193
|
Quote:
Originally Posted by Highway of Life
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. :)
|
My sql, says that
Code:
SELECT COUNT(post_id) AS total_posts
FROM posts_table
WHERE post_time > 1207677000
Gives me an error, with GROUP BY needed so yeah... :P by the way, I use the extended MySQLI php5 class library, and I use fetch_object.
__________________
VillageIdiot can have my babbies ;d
|
|
|
|