2017/09/19 17:19 ... Don Wieland:
Of these found rows, I want to omit those rows where there are rows found after
the END TimeStamp based on ?below ?where clause:
WHERE 1 AND apt.appt_status_id IN (16) AND apt.user_id IN (3) AND apt.time_start
> ‘1504238399'
We are trying to fin
.last_name, c.last_name, c.first_name;
/* end */
I want to add another condition:
Of these found rows, I want to omit those rows where there are rows found after
the END TimeStamp based on below where clause:
WHERE 1 AND apt.appt_status_id IN (16) AND apt.user_id IN (3) AND
apt.time_start > ‘15042383
gt;>>> IFNULL(f_tag_bottom_minor_axis,
>>>>>>>> IFNULL(f_tag_ch_x_bottom,
>>>>>>>>IFNULL(f_tag_ch_y_bottom, NULL) as ftag,
>>>>>>>>STDDEV
h_x_bottom, f_tag_ch_y_bottom) as ftag,
STDDEV(ch_x_top)
As Johnny Withers points out, you may repeat the expression in the
WHERE-clause:
WHERE COALESCE(f_tag_bottom, f_tag_bottom_major_axis,
f_tag_bottom_minor_axis, f_tag_ch_x_bottom, f_tag_ch_y_bottom) =
'E
FNULL(f_tag_ch_y_bottom, NULL) as ftag,
>>>>>> STDDEV(ch_x_top)
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Of course, this isn't your real problem, but you could use COAL
may repeat the expression in the
WHERE-clause:
WHERE COALESCE(f_tag_bottom, f_tag_bottom_major_axis,
f_tag_bottom_minor_axis, f_tag_ch_x_bottom, f_tag_ch_y_bottom) = 'E-CD7'
If really only one of those is not NULL, it is equivalent to this:
'E-CD7' IN (f_tag_b
> SELECT COALESCE(f_tag_bottom, f_tag_bottom_major_axis,
>>> f_tag_bottom_minor_axis, f_tag_ch_x_bottom, f_tag_ch_y_bottom) as ftag,
>>> STDDEV(ch_x_top)
>>>
>>>
>>> As Johnny Withers points out, you may repe
tag_bottom, f_tag_bottom_major_axis,
f_tag_bottom_minor_axis, f_tag_ch_x_bottom, f_tag_ch_y_bottom) as ftag,
STDDEV(ch_x_top)
As Johnny Withers points out, you may repeat the expression in the
WHERE-clause:
WHERE COALESCE(f_tag_bottom, f_tag_bottom_
one):
> SELECT COALESCE(f_tag_bottom, f_tag_bottom_major_axis,
> f_tag_bottom_minor_axis, f_tag_ch_x_bottom, f_tag_ch_y_bottom) as ftag,
> STDDEV(ch_x_top)
> ....
>
> As Johnny Withers points out, you may repeat the expression in the
> WHERE-clause
STDDEV(ch_x_top)
As Johnny Withers points out, you may repeat the expression in the
WHERE-clause:
WHERE COALESCE(f_tag_bottom, f_tag_bottom_major_axis,
f_tag_bottom_minor_axis, f_tag_ch_x_bottom, f_tag_ch_y_bottom) = 'E-CD7'
If really only one of those is not NULL,
k for me, but I need to explore this more tomorrow. I need
> the select to control the rows included in the aggregation. For
> example, the rows where the f_tag_* col that is used does not =
> 'E-CD7' should not be included in the aggregation. Also, I grossly
> simplified the
g_* col that is used does not =
'E-CD7' should not be included in the aggregation. Also, I grossly
simplified the query for this post. In reality I have 15 items in the
where clause and a having as well.
> Doing this any other way will prevent index usage and a full table scan will
> be r
On Mon, Jan 25, 2016 at 8:01 PM, Rebecca Love wrote:
> Have you tried using a select case statement for ftag?
How would that help? Unless I'm missing something, I'd still have to
have a reference to the column alias in the where clause.
>> On Jan 25, 2016, at 6:39 PM, L
this any other way will prevent index usage and a full table scan
will be required.
Is there a possibility of more than one column matching? How would you
handle that?
On Mon, Jan 25, 2016 at 6:16 PM, Larry Martell
wrote:
> I know I cannot use an alias in a where clause, but I am trying to
&g
Have you tried using a select case statement for ftag?
> On Jan 25, 2016, at 6:39 PM, Larry Martell wrote:
>
> On Mon, Jan 25, 2016 at 7:27 PM, Reindl Harald wrote:
>>
>>
>> Am 26.01.2016 um 01:16 schrieb Larry Martell:
>>>
>>> I know I ca
On Mon, Jan 25, 2016 at 7:27 PM, Reindl Harald wrote:
>
>
> Am 26.01.2016 um 01:16 schrieb Larry Martell:
>>
>> I know I cannot use an alias in a where clause, but I am trying to
>> figure out how to achieve what I need.
>>
>> If I could have an alias in a w
Am 26.01.2016 um 01:16 schrieb Larry Martell:
I know I cannot use an alias in a where clause, but I am trying to
figure out how to achieve what I need.
If I could have an alias in a where clause my sql would look like this:
SELECT IFNULL(f_tag_bottom,
IFNULL
I know I cannot use an alias in a where clause, but I am trying to
figure out how to achieve what I need.
If I could have an alias in a where clause my sql would look like this:
SELECT IFNULL(f_tag_bottom,
IFNULL(f_tag_bottom_major_axis,
IFNULL
res_results
> > WHERE (fixtures_results.away_users_id = *users.users_id*)
>
> > Any ideas why I'm getting Unknown column 'users.users_id' in 'where
> clause'
> > for the part of the statement that I've marked as *bold* and how I can
> over
> > come this pro
On Thu, 3 Feb 2011 13:55:36 +
Tompkins Neil wrote:
> SELECT DISTINCT(away_teams_id) AS teams_id
> FROM fixtures_results
> WHERE (fixtures_results.away_users_id = *users.users_id*)
> Any ideas why I'm getting Unknown column 'users.users_id' in 'where clause&
y_teams_id = users_teams.teams_id)
AND fixtures_results.status = 'approved'
ORDER BY fixtures_results.last_changed ASC LIMIT 1) <> ''
ORDER BY time_at_team ASC, time_registered ASC
Any ideas why I'm getting Unknown column 'users.users_id' in 'where clause
On 01/31/2011 12:18 PM, Jørn Dahl-Stamnes wrote:
> On Monday 31 January 2011 21:12, Phillip Baker wrote:
>
>> Greetings All,
>>
>> I am looking for a little help in setting a where clause.
>> I have a dateAdded field that is a DATETIME field.
>> I am look
On 1/31/2011 15:12, Phillip Baker wrote:
Greetings All,
I am looking for a little help in setting a where clause.
I have a dateAdded field that is a DATETIME field.
I am looking to pull records from Midnight to midnight the previous day.
I thought just passing the date (without time) would get
Thank you very much Jørn
Blessed Be
Phillip
"Never ascribe to malice what can be explained by incompetence"
-- Hanlon's Razor
On Mon, Jan 31, 2011 at 1:18 PM, Jørn Dahl-Stamnes
wrote:
> Jørn
On Monday 31 January 2011 21:12, Phillip Baker wrote:
> Greetings All,
>
> I am looking for a little help in setting a where clause.
> I have a dateAdded field that is a DATETIME field.
> I am looking to pull records from Midnight to midnight the previous day.
> I thought jus
Greetings All,
I am looking for a little help in setting a where clause.
I have a dateAdded field that is a DATETIME field.
I am looking to pull records from Midnight to midnight the previous day.
I thought just passing the date (without time) would get it but I keep
getting an empty record set
I have a table with a column pv (int)
I want to fetch all the rows r such that (r.pv)+1 is the pv-value of another
row.
what the sql looks like? thanks
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...
eams_id
> WHERE players_bids.bid_status = 'accepted'
> AND players_bids.players_id = 279
> AND players_bids.worlds_id = 1
> ORDER BY players_bids.bid_type ASC, players_bids.bid_value DESC,
> manager_points DESC, players_bids.bid_date ASC
>
> but the problem I have is that when referenci
ing players_bids.users_id_from
>> within the UNION I get back the following error :
>>
>> Error Code: 1054
>> Unknown column 'players_bids.users_id_from' in 'where clause'
>>
>> Any ideas how to overcome this problem ?
>>
>> Chee
id = 1
ORDER BY players_bids.bid_type ASC, players_bids.bid_value DESC,
manager_points DESC, players_bids.bid_date ASC
but the problem I have is that when referencing players_bids.users_id_from
within the UNION I get back the following error :
Error Code: 1054
Unknown column 'players_bids.users_id_from' in
Putting the 'HAVING' in there, works perfectly :)
THANKS!
Steven Staples
> -Original Message-
> From: SHAWN L.GREEN [mailto:shawn.l.gr...@oracle.com]
> Sent: June 10, 2010 8:03 PM
> To: Steven Staples
> Cc: 'MySql'
> Subject: Re: WHERE clause fr
On 6/10/2010 4:38 PM, Steven Staples wrote:
Ok, I have done it before, where I have used the AS result in an ORDER BY,
but now, I can't figure out why I can't use it in a WHERE clause?
SELECT `email`, (SELECT CONCAT(`phone_pref`, '-', `phone_suff`) FROM `pnums`
WHERE `id`=
Ok, I have done it before, where I have used the AS result in an ORDER BY,
but now, I can't figure out why I can't use it in a WHERE clause?
SELECT `email`, (SELECT CONCAT(`phone_pref`, '-', `phone_suff`) FROM `pnums`
WHERE `id`=`usertable`.`id`) AS pnum FROM `usertable` WHE
You can use an Alias in ORDER BY but not in WHERE clauses.
Keith
On Thu, 2010-06-10 at 16:38 -0400, Steven Staples wrote:
> Ok, I have done it before, where I have used the AS result in an ORDER BY,
> but now, I can't figure out why I can't use it in a WHERE clause?
>
> S
FROM event, mappings WHERE event.timestamp BETWEEN
'2009-12-06 20:00' and '2009-12-07 20:00:00' AND event.src_ip BETWEEN
'mappings.start_ip' AND 'mappings.end_ip' GROUP BY event.src_ip ORDER
BY count DESC LIMIT 20;
Am I supposed to do a join somewhere? Do j
Hi Paul, all!
Paul Halliday wrote:
> On Wed, Dec 9, 2009 at 2:24 PM, Joerg Bruehe wrote:
>> Hi everybody!
>>
>>
>> Neil Aggarwal wrote:
>>> Paul:
>>>
SELECT COUNT(event.src_ip) AS count, INET_NTOA(event.src_ip),
mappings.cc FROM event, mappings WHERE event.timestamp BETWEEN
'2009-
A couple of thoughts - it's not "no quotes on integers", but
"no quotes around column references". When you use 'mappings.end_ip',
you are saying "the string mappings.end_ip", and not referring to
a column in the mappings table. It just becomes a constant at that
point.
As for the performance, yo
On Wed, Dec 9, 2009 at 2:24 PM, Joerg Bruehe wrote:
> Hi everybody!
>
>
> Neil Aggarwal wrote:
>> Paul:
>>
>>> SELECT COUNT(event.src_ip) AS count, INET_NTOA(event.src_ip),
>>> mappings.cc FROM event, mappings WHERE event.timestamp BETWEEN
>>> '2009-12-06 20:00' and '2009-12-07 20:00:00' AND event
Joerg:
> A matching column is called an "equijoin"
> However, that is not mandatory / the only form.
> As long as the problem can be solved using ranges (or multiple ranges)
> which do not overlap, the join should solve it.
I just learned something. Thanks for the info!
Neil
--
Neil Agg
Hi everybody!
Neil Aggarwal wrote:
> Paul:
>
>> SELECT COUNT(event.src_ip) AS count, INET_NTOA(event.src_ip),
>> mappings.cc FROM event, mappings WHERE event.timestamp BETWEEN
>> '2009-12-06 20:00' and '2009-12-07 20:00:00' AND event.src_ip BETWEEN
>> 'mappings.start_ip' AND 'mappings.end_ip' GR
Paul:
> SELECT COUNT(event.src_ip) AS count, INET_NTOA(event.src_ip),
> mappings.cc FROM event, mappings WHERE event.timestamp BETWEEN
> '2009-12-06 20:00' and '2009-12-07 20:00:00' AND event.src_ip BETWEEN
> 'mappings.start_ip' AND 'mappings.end_ip' GROUP BY event.src_ip ORDER
> BY count DESC LIM
event.timestamp BETWEEN
'2009-12-06 20:00' and '2009-12-07 20:00:00' AND event.src_ip BETWEEN
'mappings.start_ip' AND 'mappings.end_ip' GROUP BY event.src_ip ORDER
BY count DESC LIMIT 20;
Am I supposed to do a join somewhere? Do joins even apply in a where
clause? o
DATE and DELETE statments are allowed only if then include a WHERE
> clause that spedifically identifies which records to update or delete
> by means of a key,value or if they include a LIMIT clause.
> 2. Output from single-table SELECT statments is restricted to no more
> than 1,000 ro
s are allowed only if then include a WHERE
clause that spedifically identifies which records to update or delete by
means of a key,value or if they include a LIMIT clause.
2. Output from single-table SELECT statments is restricted to no more than
1,000 rows unless the statment include a LIMIT cla
>
>
> -Original Message-
> From: Ian Simpson
> Sent: Monday, September 07, 2009 5:14 PM
> To: mysql@lists.mysql.com
> Subject: Prevent execution of queries without a WHERE clause
>
> Hi all,
>
> I vaguely recall finding mention a MySQL command or start
A)
Certified MySQL 5 Developer
Cognos BI Developer
---
Sent from HP IPAQ mobile device.
-Original Message-
From: Ian Simpson
Sent: Monday, September 07, 2009 5:14 PM
To: mysql@lists.mysql.com
Subject: Prevent execution of queries without a WHERE clause
Hi all,
I va
Hi all,
I vaguely recall finding mention a MySQL command or start-up option that
blocked any update or delete query that didn't have a WHERE component,
to prevent statements accidentally affecting too many rows (like those
of a certain absent-minded web developer who might work for the same
compan
Hi,
On Mon, Apr 14, 2008 at 1:54 PM, Jamie Madill <[EMAIL PROTECTED]> wrote:
> Hello,
>
> Basically I want to know if this is a good query for indexing.
>
> I have the following query:
>
> select
> count(1) as count
> from
> session
> where
> last >= DATE_SUB(NOW(), INTERVAL :from SECON
Hello,
Basically I want to know if this is a good query for indexing.
I have the following query:
select
count(1) as count
from
session
where
last >= DATE_SUB(NOW(), INTERVAL :from SECOND)
Is it safe to assume that the expression calling the function DATE_SUB
is evaluated just once to a f
from titles:
>
> SELECT * FROM projects
>
> I'm not sure i understand your schema enough to
> help. Are you sure you
> need a separate titles table, for instance?
Well the name is rather misleading... the database
schema was created by my japanese coworker and is not
a
from titles:
SELECT * FROM projects
I'm not sure i understand your schema enough to help. Are you sure you
need a separate titles table, for instance? And you shouldn't be able to
use the alias readerships_topics in the WHERE clause. Come to think of
it, your WHERE clause makes n
_topics.read != '1'))
I guess I should have given more background
> > I can't just the left outer join part as it's
> > autogenerated but I can change the WHERE clause
>
> Autogenerated by what, exactly? Does it run at all
> the way it is? That
>
tom wang schrieb:
Hi,
I have the following sql request:
SELECT projects.`id` AS t0_r0, projects.`name` AS
[..endless sql..]
Hi Tom,
did you understand that query (in lets say 3 months) if you need to fix
a bug? If not it maybe better to simplify that.
regards
-ralf
--
MySQL General Mai
readerships_topics.topic_id = topics_posts.id
I'll take your word for it!
and I have a condition on both of those tables in my
where clause:
WHERE (readerships.read != '1' OR
readerships_topics.read != '1')
Not that I'm going to pretend to understand the goal o
;1') AND (roles_users.user_id = '6' OR
users_roles_join.user_id = '6'))
As you can see I have two left outerjoins involving
the readerships table:
LEFT OUTER JOIN readerships ON readerships.topic_id =
topics.id
and
LEFT OUTER JOIN readerships readerships_topics ON
readersh
I have two tables I just what the data from the 1 table that is not in the
2 table So in this example I what row formelements_id 22 and 23. I have
tried different sql statements one is below
SELECT customformelements.formelements_id
,dbelements.customer_id,customformelements.formelements_field_
with WHERE clause
Hi Kerry,
Try this:
SELECT t1.*,t2.thedescription AS t2desc FROM table1 AS t1 LEFT JOIN table2
AS t2 ON t1.linkfield=t2.linkfield WHERE t1.lookup='Z'
Without the WHERE condition this would return all 1000 rows of table 1
since "A Left join returns
It sounds to me like you're needing to use a left outer join on t2.
Give that a shot instead of the inner join you're currently using.
Cheers,
-bemansell
On 2/17/07, Kerry Frater <[EMAIL PROTECTED]> wrote:
I am trying to select a particular row from a table and include a column for
aq second ta
I am trying to select a particular row from a table and include a column for
aq second table but I cannot get the result I am after.
I have "table1" with 1000 rows and "table2" with 12 rows. The relationship
between the tables is a column "linkedfield". Table1 has a unique key called
"lookup"
If
gt; p.rider_id=236 and fee > 0 group by s.id order by s.f_date;
>
> which gives me the error:
>
> ERROR 1052 (23000): Column 'fee' in where clause is ambiguous
>
> Without the 'and fee > 0' the query works fine.
>
> mysql> select version();
&
ice is a waste of cputime. I say
trying here because this is what fails, you are not allowed to call sum
in your where clause, thus the "Invalid use of group function".
try
SELECT s.id, s.name, SUM(p.fee) AS fee_total
FROM serie AS s
INNER JOIN race_serie AS rs ON rs.serie
On Sunday 30 July 2006 12:37, Gabriel PREDA wrote:
> You must specify explicitly what 'fee' to use... so if you wand every
> p.fee to be greater than zero then you must do:
>
> SELECT s.id, s.name, SUM(p.fee) AS fee
> FROM serie AS s
> INNER JOIN race_serie AS rs ON rs.serie_id = s.id
>
You must specify explicitly what 'fee' to use... so if you wand every
p.fee to be greater than zero then you must do:
SELECT s.id, s.name, SUM(p.fee) AS fee
FROM serie AS s
INNER JOIN race_serie AS rs ON rs.serie_id = s.id
INNER JOIN races AS r ON r.id = rs.race_id
INNER JOIN particip
Hello Jørn Dahl-Stamnes,
The column 'fee' is existing in more than one table . To overcome this
problem use the correct instance name of the table for the column "fee" In
WHERE clause
select
s.id,
s.name,
sum(p.fee) as fee
from serie as s
inner join race_
; 0 group by s.id order by s.f_date;
which gives me the error:
ERROR 1052 (23000): Column 'fee' in where clause is ambiguous
It looks as if you already have a column called
fee in the participants table - I'm looking at
"sum(p.fee)" - so you're in trouble if you use
by s.f_date;
which gives me the error:
ERROR 1052 (23000): Column 'fee' in where clause is ambiguous
Without the 'and fee > 0' the query works fine.
mysql> select version();
++
| version() |
++
| 4.1.8-standard |
+
At 17:20 +0200 11/4/06, Barry wrote:
Japanese say here: Ganbatte! (Do your best!)
Oh, so true! DYB! DYB! DYB!
Hmmm - now you've confused me a bit. Quoting from the section in
the DuBois book:
"...a LEFT JOIN forces the result set to contain a row for every
row in the left side table, wheth
Barry wrote:
Chris Sansom wrote:
Yeah - it certainly seems promising. Better do some more reading!
Japanese say here: Ganbatte! (Do your best!)
Hmmm - now you've confused me a bit. Quoting from the section in the
DuBois book:
"...a LEFT JOIN forces the result set to contain a row for eve
Chris Sansom wrote:
Yeah - it certainly seems promising. Better do some more reading!
Japanese say here: Ganbatte! (Do your best!)
Hmmm - now you've confused me a bit. Quoting from the section in the
DuBois book:
"...a LEFT JOIN forces the result set to contain a row for every row in
the
content) WHERE t2.id = t1.id (Hi, i'm
table 2 but only giving you the content you wanted to see with your
WHERE clause, i keep the rest for myself!!)
Hmmm - now you've confused me a bit. Quoting from the section in the
DuBois book:
"...a LEFT JOIN forces the result set to conta
= table2.id
LEFT join puts the WHOLE table2 to the right of the LEFT JOINED table1.
example:
(Hi, i'm table 1 with all my content) LEFT JOIN (Hi, i'm table 2 with
all my content)
if you use Where:
(Hi, i'm table 1 with all my content) WHERE t2.id = t1.id (Hi, i'm table
2 but
At 16:37 +0200 11/4/06, Barry wrote:
select [what you want]
from t1
LEFT JOIN t2 ON t2.id = t1.id
LEFT JOIN t3 ON t3.id = t1.id
LEFT JOIN t4 ON t4.id = t1.id
LEFT JOIN t5 ON t5.id = t1.id
LEFT JOIN t6 ON t6.id = t1.id
where
t2.text like '%search_term%' OR t3.text like '%search_term%' O
At 9:28 -0500 11/4/06, mos wrote:
If you keep it in 5 different tables, the search will be as
slow as molasses in January because of the joins. I'd recommend
using FullText search on the text field.
Hi Mike
Thanks for the rapid response! OK - I've set all those text fields as
FullTex
Chris Sansom wrote:
Ah forgot something. Make sure you have placed indizies on the 'id' fields.
This will make it even faster.
Greets
Barry
--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)
--
MySQL General Mailing List
For list archives: http://lists.mysq
Chris Sansom wrote:
First I should say I'm using MySQL 3.23.x because that's what's
currently available on our host's server. An upgrade to 5.x is promised
any time now, but I'm not holding my breath! So, with that in mind...
I'm trying to do quite a sophisticated search across several tables
Chris,
If you keep it in 5 different tables, the search will be as slow
as molasses in January because of the joins. I'd recommend using FullText
search on the text field. You *may* be able to do a Merge table on the 5
tables so MySQL sees it as 1 table. I'm not sure which of these feat
First I should say I'm using MySQL 3.23.x because that's what's
currently available on our host's server. An upgrade to 5.x is
promised any time now, but I'm not holding my breath! So, with that
in mind...
I'm trying to do quite a sophisticated search across several tables
and am running into
Dan Rossi <[EMAIL PROTECTED]> wrote on 12/29/2005 07:19:13 AM:
> Thanks for your kind words of opinion, if you feel you have a better
> way please do go ahead , i am going to show you the sql i ended up
> using which was a union to append the current summary at the end, i
> then had to use php
D=c.customerID
INNER JOIN feeds f ON fu.feedID=f.feedID WHERE f.feedID IN (SELECT
feedID FROM producers_join WHERE producerID IN (3)) GROUP BY
fu.month,fu.customerID ORDER BY fu.month DESC
END
On 28/12/2005, at 4:47 PM, [EMAIL PROTECTED] wrote:
Dan Rossi <[EMAIL PROTECTED]> wrote on 12/2
ND [EMAIL PROTECTED] AND fu.feedID IN
(SELECT
> >> > feedID FROM producers_join WHERE producerID IN (3))),
> >> >
> >> > @percentage:=((@feed_bandwidth/@total_bandwidth)) AS percentage,
> >> >
> >> > @month_totals:=(SELECT month_total FROM month_totals WHERE
> >> > [EMAIL PROTECTED] AND DATE_FORMAT(month,"%m")[EMAIL PROTECTED] GROUP BY
> >> > month, customerID) AS month_totals,
> >> >
> >> > @count:=(SELECT count(*) FROM feeds WHERE feedID IN (@feeds)),
> >> >
> >> > @feed_count:=(SELECT count(*) FROM month_totals WHERE
> >> > [EMAIL PROTECTED] AND [EMAIL PROTECTED] AND feedID IN (SELECT
> >> feedID
> >> > FROM producers_join WHERE producerID IN (3))),
> >> >
> >> > ROUND(( IF(c.bandwidth_limit=0,
> >> > ((c.monthly_price/@count)*f.percentage_paid)[EMAIL PROTECTED],
> >> > ((@[EMAIL PROTECTED])*f.percentage_paid) )),0) AS
> >> providers_cut
> >> >
> >> > FROM feed_usage fu INNER JOIN customers c ON
> >> fu.customerID=c.customerID
> >> > INNER JOIN feeds f ON fu.feedID=f.feedID WHERE f.feedID IN (SELECT
> >> > feedID FROM producers_join WHERE producerID IN (3)) GROUP BY
> >> > fu.month,fu.customerID ORDER BY fu.month DESC
> >> >
> >> > END
> >> >
> >> > On 28/12/2005, at 4:47 PM, [EMAIL PROTECTED] wrote:
> >> >
> >> > > Dan Rossi <[EMAIL PROTECTED]> wrote on 12/27/2005 11:39:57
> >> PM:
> >> > >
> >> > >> Hi there i am trying to use usewr variables in a select
> >> statement to
> >> > >> add to a where clause in a sub query. Ie
thly_price/@count)*f.percentage_paid)[EMAIL PROTECTED],
> ((@[EMAIL PROTECTED])*f.percentage_paid) )),0) AS
providers_cut
>
> FROM feed_usage fu INNER JOIN customers c ON
fu.customerID=c.customerID
> INNER JOIN feeds f ON fu.feedID=f.feedID WHERE f.feedID IN (SELECT
> feedID
> feedID FROM producers_join WHERE producerID IN (3)) GROUP BY
> fu.month,fu.customerID ORDER BY fu.month DESC
>
> END
>
> On 28/12/2005, at 4:47 PM, [EMAIL PROTECTED] wrote:
>
> > Dan Rossi <[EMAIL PROTECTED]> wrote on 12/27/2005 11:39:57
PM:
> >
&g
CT
feedID FROM producers_join WHERE producerID IN (3)) GROUP BY
fu.month,fu.customerID ORDER BY fu.month DESC
END
On 28/12/2005, at 4:47 PM, [EMAIL PROTECTED] wrote:
Dan Rossi <[EMAIL PROTECTED]> wrote on 12/27/2005 11:39:57 PM:
Hi there i am trying to use usewr variables in a select stat
AS providers_cut
>
> FROM feed_usage fu INNER JOIN customers c ON fu.customerID=c.customerID
> INNER JOIN feeds f ON fu.feedID=f.feedID WHERE f.feedID IN (SELECT
> feedID FROM producers_join WHERE producerID IN (3)) GROUP BY
> fu.month,fu.customerID ORDER BY fu.month DESC
>
> END
4:47 PM, [EMAIL PROTECTED] wrote:
Dan Rossi <[EMAIL PROTECTED]> wrote on 12/27/2005 11:39:57 PM:
Hi there i am trying to use usewr variables in a select statement to
add to a where clause in a sub query. Ie
select @id:=id,@month:=month, (select SUM(totals) from table where
[EMAIL PROTECTE
Dan Rossi <[EMAIL PROTECTED]> wrote on 12/27/2005 11:39:57 PM:
> Hi there i am trying to use usewr variables in a select statement to
> add to a where clause in a sub query. Ie
>
> select @id:=id,@month:=month, (select SUM(totals) from table where
> [EMAIL PROTECTED] and
Hi there i am trying to use usewr variables in a select statement to
add to a where clause in a sub query. Ie
select @id:=id,@month:=month, (select SUM(totals) from table where
[EMAIL PROTECTED] and [EMAIL PROTECTED]) as totals from table
its happened on other occasions ie with calculations
Your query was:
SELECT distinct accomodation.accom_id FROM accomodation LEFT JOIN
student_accom ON accomodation.accom_id = student_accom.accom_id where
((student_accom.start_date Between '2005-10-01' And '2005-11-30') OR
(student_accom.leave_date Between '2005-10-01' And '2005-10-30'))
The logic:
Not sure what you are asking for. If you are trying to get the
opposite of what you are getting, try adding
AND student_accom.start_date IS NULL
to the end of the query. You can actually use just about any field
instead of start_date.
For easier readability, you can rephrase your query to
Hello,
I'm running mysql 4.0.12
I have a bookings database in which I'm having problems pulling out the
available accomodation.
Tables are:
Accomodation - accomid (primary key), town, address, contactnumber etc
student_accom - studentaccomid (primary key), accomid, studentid
My query is as follo
Hi,
What about SELECT count(*) FROM table1 - SELECT count(*) FROM table1
WHERE status = 1 ? (this query should be mush faster)
Regards,
Jocelyn
jpow wrote:
Hi everyone, I have this problem of slow "count *" when I use a where clause.
1. I have a table of ~1m rows.
2. There is
Hi everyone, I have this problem of slow "count *" when I use a where clause.
1. I have a table of ~1m rows.
2. There is a "status" column which can be 0 or 1.
3. Most of the rows have a status of 0, but maybe 10% of them have a
status of 1.
4. I need to know how many records
Christopher Malton wrote:
When I use the statement:
EXPLAIN SELECT * FROM workunits WHERE Sent>0
It returns
+---+--+---++-++-++
| table | type | possible_keys | key| key_len | ref|
rows| Extra |
+---
When I use the statement:
EXPLAIN SELECT * FROM workunits WHERE Sent>0
It returns
+---+--+---++-++-++
| table | type |
possible_keys | key | key_len | ref |
rows | Extra |
+---+--
In article <[EMAIL PROTECTED]>,
Morten Egan <[EMAIL PROTECTED]> writes:
> Well, it might not be SQL standard, but most databases out there allow
> you to use the alias in your where clauses. It helps make the sql more
> readable, and it shouldn't be that hard to add this feature to the
> parser, s
Sorry, mailed it in html format. Read answer below
Original Message
Subject:Re: Where clause question
Date: Tue, 12 Oct 2004 00:00:12 +0200
From: Morten Egan <[EMAIL PROTECTED]>
To: Ed Lazor <[EMAIL PROTECTED]>
CC: [EMAIL PROTECTED]
Not kno
> >> ), 2 ) + POWER( (
> >> longitude + 95.689508
> >> ), 2 ) ) AS distance
> >> FROM geographics
> >> WHERE distance <1
> >> ORDER BY distance
> >> LIMIT 10;
> >>
> >> Returns:
> >> #1054 - Unknow
- Original Message -
From: "Ed Lazor" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, October 11, 2004 4:51 PM
Subject: RE: Where clause question
Interesting. I thought you could sort by aliases. Thanks Shawn.
The easy answer was to just add the calculati
Interesting. I thought you could sort by aliases. Thanks Shawn.
The easy answer was to just add the calculation to the where section as
well. But which approach is faster - "having" or the calculation?
Ie.
select ID, Title, MSRP, Price, round( ( (MSRP - Price) / MSRP) * 100) as
discount from
n column 'distance' in 'where clause'
Are alias not allowed in WHERE clauses?
How could they be? The WHERE clause determines which rows to select.
Aliases are defined for columns from the rows that have been selected.
I am able to replace the alias with the entire math funct
1 - 100 of 260 matches
Mail list logo