I should have given an example ..
select count(*) as record_count, date(column_name) as date_field,
'my_table' as table_name
union all
select count(*) as record_count, date(column_name) as date_field,
'my_table_2' as table_name
and end up with:
count | date | table_name
Niel, thanks (I was wondering about that... thought it seemed odd
without a FROM clause)
Now I have this:
$query = SELECT COUNT(*) AS landing_count, date(solarLandingDateTime)
AS solarLandingDate, 't7solar_landingALIAS' AS t7solar_landing FROM
t7solar_landing GROUP BY
Can someone point me to understand why? I thought that:
SELECT COUNT(*) AS landing_count, date(solarLandingDateTime) AS
solarLandingDate, 't7solar_landingALIAS' AS t7solar_landing FROM
t7solar_landing GROUP BY DATE(solarLandingDateTime)
would, among other thing, assign the number of records
Just shooting from the hip, I would say the faster method would be to create
the 5 different mysql queries. The amount of time taken up by retrieving
500 articles of either blob or text can add up to a significant amount of
time, whereas 5 queries that average 10 results per query would result in
Yes, but when you UNION that query with others it gets a bit more
complicated
...
If you prefer the latter syntax, you can use mysql_fetch_object().
Ben
Bless you Ben!!
That last post of yours led to my first decent dose of real
significant SQL-syntax understanding since I started writing
On Aug 4, 2009, at 6:21 PM, Chris dmag...@gmail.com wrote:
Govinda wrote:
I should have given an example ..
select count(*) as record_count, date(column_name) as date_field,
'my_table' as table_name
union all
select count(*) as record_count, date(column_name) as date_field,
this:
-
$query = SELECT COUNT(*) AS `CountUniqueDatesInMyTbl`,
date(solarLandingDateTime) AS `uniqueDate`, 't7solar_landing' AS
`tableAlias` FROM t7solar_landing GROUP BY DATE(solarLandingDateTime)
UNION ALL SELECT count(*) AS
On Aug 4, 2009, at 7:18 PM, Martin Zvarík mzva...@gmail.com wrote:
I need to do about 5 queries:
1) pick the top visited articles
2) pick the recent articles (limit 10)
3) pick the most commented articles
etc.
Now, I have 2 choices:
1) SELECT ALL records and use PHP for conditions
2) do
With a union the columns have to have the same name (or alias).
Eg:
SELECT
COUNT(*) AS count,
date(solarLandingDateTime) AS unique_date,
't7solar_landingALIAS' AS origin
FROM tablename
UNION ALL
SELECT
count(*) AS count,
date(solarAweberConfDateTime) AS unique_date,
Taking this:
SELECT count(*) AS
`CountUniqueDatesInMyTbl`, date(solarAWDateTime) AS `uniqueDate`,
'aweber_7solar_aw' AS `tableAlias` FROM aweber_7solar_aw GROUP BY
DATE(solarAWDateTime)
Your query says:
get the date() from the solarAWDateTime field
then
group by that date
and give me the date
MANLIFT NOW IN QATAR !
Introducing the Manlift Group - a leading provider of Temporary Power and
Access Platforms
Power Rental
* Turnkey power solutions ranging from 30kva - 30MW
* Containerised gensets by Cummins and Ingersoll Rand
* Step-up transformers and ancillary equipment
* Logistics
11 matches
Mail list logo