Re: help with query to count rows while excluding certain rows

2016-01-02 Thread Larry Martell
On Fri, Jan 1, 2016 at 9:31 PM, Peter Brawley wrote: > On 1/1/2016 19:24, Larry Martell wrote: >> >> On Fri, Jan 1, 2016 at 2:12 PM, Peter Brawley >> wrote: >>> >>> On 12/31/2015 0:51, Larry Martell wrote: I need to count the number of rows in a table that are grouped by a list of

Re: help with query to count rows while excluding certain rows

2016-01-01 Thread Larry Martell
On Fri, Jan 1, 2016 at 2:12 PM, Peter Brawley wrote: > On 12/31/2015 0:51, Larry Martell wrote: >> >> I need to count the number of rows in a table that are grouped by a >> list of columns, but I also need to exclude rows that have more then >> some count when grouped by a different set of columns

Re: help with query to count rows while excluding certain rows

2016-01-01 Thread Peter Brawley
On 12/31/2015 0:51, Larry Martell wrote: I need to count the number of rows in a table that are grouped by a list of columns, but I also need to exclude rows that have more then some count when grouped by a different set of columns. Conceptually, this is not hard, but I am having trouble doing th

Re: Help with query.

2011-02-02 Thread Simcha Younger
On Tue, 1 Feb 2011 14:46:39 -0400 Paul Halliday wrote: > I have a query (thanks to this list) that uses a join to add country > information to an IP. It looks like this: > > SELECT COUNT(signature) AS count, INET_NTOA(src_ip), map1.cc as > src_cc, INET_NTOA(dst_ip), map2.cc as dst_cc > FROM even

Re: Help with query.

2011-02-02 Thread Joerg Bruehe
Hi Paul! Paul Halliday wrote: > I have a query (thanks to this list) that uses a join to add country > information to an IP. It looks like this: > > SELECT COUNT(signature) AS count, INET_NTOA(src_ip), map1.cc as > src_cc, INET_NTOA(dst_ip), map2.cc as dst_cc > FROM event LEFT JOIN mappings AS m

Re: help with query

2011-01-12 Thread Simon Wilkinson
Thank you, that did the trick. Simon On 11 January 2011 12:09, Steve Meyers wrote: > On 1/11/11 9:31 AM, Simon Wilkinson wrote: > >> select users.id from users where users.id in (select newletters.user_id >> from >> newletters left join articles on newletters.id = articles.newsletter_id >> wher

Re: help with query

2011-01-11 Thread Steve Meyers
On 1/11/11 9:31 AM, Simon Wilkinson wrote: select users.id from users where users.id in (select newletters.user_id from newletters left join articles on newletters.id = articles.newsletter_id where articles.newsletter_id is null); I think this would do what you require: SELECT u.id AS user_i

Re: Help with query

2008-12-15 Thread Néstor
Sorry!!! I apoligized for being blind. Yes, in my small mind I was thinking that I do not have records biggeer than 2008 but I do and my mind refused to see the records for 2009 and 2010. Sorry again for being so blind to the obvious. :-( On Mon, Dec 15, 2008 at 9:50 AM, Phil wrote: > Am I

Re: Help with query

2008-12-15 Thread Phil
Am I totally missing something? Why do you believe the two queries should return the same # of rows? First one has a qualification of proj_adv_date < '2008-12-16' whilst the second one does not... On Mon, Dec 15, 2008 at 12:12 PM, Néstor wrote: > I have a char fiel where I am keeping dates forma

Re: Help with query

2008-12-15 Thread John Daisley
Are you sure those are the results to those queries? ¢,m Your second query will return more because it includes values outside of the date range specified in the first query. In the second result set you have 2009 and 'invalid dates' that would not be picked up by the first query. Regards Joh

Re: Help with query to remove all records where foreign key doesn't have corresponding records

2008-08-13 Thread Brent Baisley
Just do a left join with the delete query. DELETE feed_tag FROM feed_tag LEFT JOIN feed ON feed_tag.feed_id=feed.id WHERE feed.id IS NULL That should do it. You can change "DELETE feed_tag" to "SELECT" and test it first. -- Brent Baisley On Aug 13, 2008, at 4:51 PM, Daevid Vincent wrote

Re: Help with query to remove all records where foreign key doesn't have corresponding records

2008-08-13 Thread Isart Montane
Hi Daevid If you are using a foreign key you can set the reference as "cascade" and when a row is deleted from feed it will be deleted from feed_tag. http://dev.mysql.com/doc/refman/5.0/en/innodb-foreign-key-constraints.html If you don't like it you can delete it easy with a query like this del

Re: Help with query MySQL and PHP

2008-07-03 Thread Ananda Kumar
you can do some thing like this. create table new_table(id int, hair varchar(50),eyes varchar(50)) select column1,column2,...from old_table; On 7/3/08, axis <[EMAIL PROTECTED]> wrote: > > This question is strictly related to the mysql query not the php code. > I need to either create a new tab

Re: Help with query MySQL and PHP

2008-07-03 Thread axis
This question is strictly related to the mysql query not the php code. I need to either create a new table from the old one or add columns. The thing is don't know how to do it. let me simplify things up: I need a query to retrieve values from the table PRODUCTS_TO_PRODUCTS_EXTRA_FIELDS to a ne

Re: help with query optimization

2008-01-09 Thread Brent Baisley
Your biggest problem is probably the subquery/IN your are performing. You should change that to a join. And I don't know about using SQL_CALC_FOUND_ROWS in a full text query that's not boolean, and you shouldn't use it unless you have a LIMIT clause. SELECT SQL_CALC_FOUND_ROWS table_1.id,ta

RE: Help with query, (question simplified as last mail was very complicated to understand :))

2007-12-30 Thread Martin Gainty
r does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission.> Date: Sun, 30 Dec 2007 13:54:32 +0100> From: [EMAIL PROTECTED]> To: mysql@lists.mysql.com> Subject: Re: Help with query, (questi

Re: Help with query, (question simplified as last mail was very complicated to understand :))

2007-12-30 Thread Richard
Richard a écrit : Sorry about my last email which was long and not clear. This is what I want to do Join two tables on "code table1" = "code table3" where messageid = for example 28 table 1 contains : message from messageid --

Re: Help with query...

2007-10-14 Thread mysql
Anders Norrbring wrote: I'm trying to set up a query, but I don't really get the result I expected, so can someone please help me out here? The query I've built is this: SELECT a1.username FROM accountuser AS a1 LEFT JOIN (freeaccounts AS f1, payments AS p1) ON (a1.username = p1.username AND p

Re: Help with Query

2007-05-07 Thread Baron Schwartz
Hi Ed, Ed Curtis wrote: I need to get some duplicate record information from a table and I haven't found any way to do it yet. I figured there might be some type of query I could do using a "for each" type command. What I have is a table with names and companies. Some people have multiple en

RE: help with query: select customers that ARO NOT in orders t

2006-10-23 Thread Waldemar Jankowski
20, 2006 1:53 PM To: [EMAIL PROTECTED] Cc: mysql@lists.mysql.com Subject: Re: help with query: select customers that ARO NOT in orders table On Fri, 20 Oct 2006, [EMAIL PROTECTED] wrote: hi to all, I have table customers (PK cust_id) I have table orders (PK order_id, FK cust_id) I need query t

RE: help with query: select customers that ARO NOT in orders table

2006-10-23 Thread Jerry Schwartz
, CT 06032 860.674.8796 / FAX: 860.674.8341 > -Original Message- > From: Waldemar Jankowski [mailto:[EMAIL PROTECTED] > Sent: Friday, October 20, 2006 1:53 PM > To: [EMAIL PROTECTED] > Cc: mysql@lists.mysql.com > Subject: Re: help with query: select customers that ARO NOT

Re: help with query: select customers that ARO NOT in orders table

2006-10-20 Thread Waldemar Jankowski
On Fri, 20 Oct 2006, [EMAIL PROTECTED] wrote: Ok. Just found I gave wrong info. To make my life easier, the person who created db named cust_id in 'orders' table as SoldTo [EMAIL PROTECTED] in this case, select cust_id from customers where cust_id not in (select Soldto from orders); will no

Re: help with query: select customers that ARO NOT in orders table

2006-10-20 Thread afan
Ok. Just found I gave wrong info. To make my life easier, the person who created db named cust_id in 'orders' table as SoldTo [EMAIL PROTECTED] in this case, select cust_id from customers where cust_id not in (select Soldto from orders); will not work :( > On Fri, 20 Oct 2006, [EMAIL P

Re: help with query: select customers that ARO NOT in orders table

2006-10-20 Thread Waldemar Jankowski
On Fri, 20 Oct 2006, [EMAIL PROTECTED] wrote: hi to all, I have table customers (PK cust_id) I have table orders (PK order_id, FK cust_id) I need query that will selecct all customers from 'customers' they don't have any order, there is not their cust_id in 'orders'. couls somebody help me? t

Re: Help with query

2006-09-26 Thread Visolve DB Team
Hi, Try with FULLTEXT search. Alter the table to make the search columns as FULLTEXT columns, with MyISAM engine and retrieve the records using MATCH keyword. Ref:http://dev.mysql.com/doc/refman/5.0/en/fulltext-search.html Thanks, ViSolve DB Team. - Original Message - From: "Ed Curt

RE: Help with query

2006-09-25 Thread Jerry Schwartz
Have you dumped out your variables to make sure none of them is a zero-length string? That would surely cause your problem. Regards, Jerry Schwartz Global Information Incorporated 195 Farmington Ave. Farmington, CT 06032 860.674.8796 / FAX: 860.674.8341 -Original Message- From: Ed Curt

Re: Help with query

2006-08-21 Thread Jesse
. I really appreciate your help. Jesse - Original Message - From: Douglas Sims To: Jesse Cc: MySQL List Sent: Monday, August 21, 2006 12:07 PM Subject: Re: Help with query I think you are trying to use a regular expression in the like phrase. I wasn't aware that MS SQL

Re: Help with query

2006-08-21 Thread Douglas Sims
I think you are trying to use a regular expression in the like phrase. I wasn't aware that MS SQL can do regular expressions at all? I've been using 2000 - perhaps the newer version can? In MySQL, instead of saying: LA.LastName LIKE '[A-E]%' try this: LA.LastName REGEXP '^[A-E]' You can

Re: Help with query: Row number / Rank from a query...

2006-06-02 Thread Dan
Thanks Peter, That looks pretty good to me. I never would have figured that out on my own. Dan T On Jun 1, 2006, at 4:06 PM, Peter Brawley wrote: Dan, >I want to get a particular users 'rank' or row number from the query. SELECT 1+COUNT(*) AS Rank FROM results r1 INNER JOIN results r2 O

Re: Help with query: Row number / Rank from a query...

2006-06-01 Thread Peter Brawley
Dan, >I want to get a particular users 'rank' or row number from the query. SELECT 1+COUNT(*) AS Rank FROM results r1 INNER JOIN results r2 ON r1.points I have a regular query lets say: SELECT user, points FROM results ORDER BY points DESC so I get: userpoints --- john23 s

Re: Help with query: Row number / Rank from a query...

2006-06-01 Thread Michael Stassen
Dan wrote: I have a regular query lets say: Better to show the real query, rather than a simplified version. Simplified requests get you simplified answers. What seems like a simplification to you, may in fact hide a crucial piece of information, thus preventing anyone from giving you a so

Re: Help with Query Optimization

2006-02-28 Thread Peter Brawley
Kishore, > We use Vbulletin for our message boards, and I have a query which >takes approximately 1.2 - 1.5 seconds to execute, on a table ('thread') >having around 130,000 rows, it is as follows >SELECT threadid >FROM thread >LEFT JOIN deletionlog >ON ( thread.threadid = deletionlog

Re: help with query

2006-02-21 Thread Peter Brawley
>how to achieve this? >select table1.*, table2.*, table3.*, sum(table2.field3), sum(table2.field4) >from table1, table2, table3 where table1.field1 = table2.field1 and >table2.field1 = table3.field1 Your question as formulated has no answer. If you query aggregate values like Sum on a table, y

Re: Help with query optimization & query SUM

2006-02-06 Thread سيد هادی راستگوی حقی
Dear Reynier, You can use JOIN on your both, The JOIN have to run on the same feilds i.e IDA. SELECT * FROM carro_de_compras LEFT JOIN os_articulo ON carro_de_compras.IDA = os_articulo.IDA This query returns all your users with their articles if any and you can iterate on it. but one note: Use

Re: Help with query

2006-01-25 Thread SGreen
Jay Paulson <[EMAIL PROTECTED]> wrote on 01/25/2006 10:09:36 AM: > From the result set below I have 22 rows and the only difference is the > date. I was wondering if there was a way to get all of these results using > GROUP BY instead of having to use LIMIT?? > > As this table grows I'm going t

Re: help with query

2005-10-22 Thread Peter Brawley
ja, Your question is a little cryptic. If a questionid column value identifies a particular question, and a vote column value contains a user's vote (1,2,3, &c), can't you just write... SELECT questionid, vote,count(vote) FROM ... GROUP BY questionid, vote PB - [EMAIL PROTECTED] wrote:

Re: help with query

2005-10-22 Thread SGreen
<[EMAIL PROTECTED]> wrote on 10/22/2005 06:24:07 PM: > > > I have a table of votes with four fields, a primary key, and userID, > that are just there for tracking purposes. But then I have > questionID and vote fields. For each question, a user could pick a > number of it's importance from 1

Re: Help with query

2005-10-13 Thread Dušan Pavlica
Shawn, - Original Message - From: [EMAIL PROTECTED] To: Dušan Pavlica Cc: Michael Stassen ; list mysql Sent: Wednesday, October 12, 2005 4:45 PM Subject: Re: Help with query Dušan Pavlica <[EMAIL PROTECTED]> wrote on 10/12/2005 10:00:53 AM: > Thanks, Mi

Re: Help with query

2005-10-12 Thread SGreen
ECTED]> > To: "Dušan Pavlica" <[EMAIL PROTECTED]> > Cc: "list mysql" > Sent: Wednesday, October 12, 2005 2:54 PM > Subject: Re: Help with query > > > > Dušan Pavlica wrote: > >> Hello, > >> > >> could someone help me

Re: Help with query

2005-10-12 Thread Dušan Pavlica
t want to write querries for each DB system separately. Now I see that I will have to. Dusan - Original Message - From: "Michael Stassen" <[EMAIL PROTECTED]> To: "Dušan Pavlica" <[EMAIL PROTECTED]> Cc: "list mysql" Sent: Wednesday, October 12, 2

Re: Help with query

2005-10-12 Thread Michael Stassen
Dušan Pavlica wrote: Hello, could someone help me please to construct correct query or tell me what I'm doing wrong? I have three tables: table products table products_codes where some products could have assigned another additional codes table products_prices I want to get all rows from pro

Re: Help with query using IN()

2005-10-05 Thread Felix Geerinckx
On 04/10/2005, Jasper Bryant-Greene wrote: > Kishore Jalleda wrote: > > Could you kindly advice if this query can be made to run faster > > SELECT title, template > > FROM template > > WHERE templateid IN > > (608,2072,2073,1888,1898,1895,1897,1894,1896,1901,1903,1889,1900,189 > > 0,1891,1902,1904

Re: Help with query using IN()

2005-10-04 Thread Jasper Bryant-Greene
Kishore Jalleda wrote: Could you kindly advice if this query can be made to run faster SELECT title, template FROM template WHERE templateid IN (608,2072,2073,1888,1898,1895,1897,1894,1896,1901,1903,1889,1900,1890,1891,1902,1904,2104,624,625,2152,2212,1985,1996,614,1964,2103,2106,2113,1982,1983

Re: Help with query

2005-05-16 Thread Ronan Lucio
Mathias, To drop multiple IP, you can use distinct : mysql> SELECT year, month, day, group_concat(distinct ip),count(*) AS access -> FROM access -> WHERE year = 2005 -> AND month = 5 -> GROUP BY year, month,day -> ORDER BY year, month, day; +--+---+--+---

Re: Help with query

2005-05-16 Thread mfatene
Hi Ronan, I don't know if i understand your need, but your query gives something like that : mysql> SELECT year, month, day, ip, COUNT(*) AS access -> FROM access -> WHERE year = 2005 -> AND month = 5 -> GROUP BY year, month, day, ip -> ORDER BY year, month, day; +--

Re: Help with query

2005-05-16 Thread SGreen
"Ronan Lucio" <[EMAIL PROTECTED]> wrote on 05/16/2005 04:21:17 PM: > Mathias, > > > Hi, > > look at group by ... with rollup at : > > http://dev.mysql.com/doc/mysql/en/group-by-modifiers.html > > Thank you very much for your help. > > My needs aren´t this, exactly. > > GROUP BY WITH ROLLUP, re

Re: Help with query

2005-05-16 Thread Ronan Lucio
Mathias, Hi, look at group by ... with rollup at : http://dev.mysql.com/doc/mysql/en/group-by-modifiers.html Thank you very much for your help. My needs aren´t this, exactly. GROUP BY WITH ROLLUP, returns me several lines of the same day (one per IP), plus the total. I need that every year-month-da

Re: Help with query

2005-05-16 Thread mfatene
Hi, look at group by ... with rollup at : http://dev.mysql.com/doc/mysql/en/group-by-modifiers.html Mathias Selon Ronan Lucio <[EMAIL PROTECTED]>: > Hello, > > I have a table where is saved all site´s access: > > access > > id > year > month > day > weekday > hour > minute > ip > > Any colu

Re: !! Help with query: Where Date = MAX(Date)

2005-02-04 Thread Michael Dykman
On Fri, 2005-02-04 at 09:19, Graham Cossey wrote: > Could someone please offer a little help. > > I have a table like: > > Year, Month, Start_date > 20041020041102 > 20041120041203 > 20041220050104 > 20050120050204 > 20050220050303 > > I need to get the la

RE: !! Help with query: Where Date = MAX(Date)

2005-02-04 Thread Graham Cossey
> > As I'm using 4.0.20 I can't use subqueries so how can I create > a query that > > does this? > > > > SELECT year, month > > FROM `dc_months` > > WHERE start_date = (SELECT MAX(start_date) > > from dc_months > > where start_date <= '20050204') > >

Re: !! Help with query: Where Date = MAX(Date)

2005-02-04 Thread Philippe Poelvoorde
Graham Cossey wrote: Could someone please offer a little help. I have a table like: Year, Month, Start_date 20041020041102 20041120041203 20041220050104 20050120050204 20050220050303 I need to get the latest Year,Month for a given date, so for example today (

RE: Help with query performance anomaly

2004-11-13 Thread Graham Cossey
Thanks for the advice Steven, I'll bear it in mind and do some reading. Graham > -Original Message- > From: Steven Roussey [mailto:[EMAIL PROTECTED] > Sent: 13 November 2004 02:52 > To: 'Graham Cossey' > Cc: [EMAIL PROTECTED] > Subject: RE: Help with qu

RE: Help with query performance anomaly

2004-11-12 Thread Steven Roussey
For production systems, I would never let the mysql optimizer guess a query plan when there are joins of big tables and you know exactly how it should behave. Once you think a query is finished, you should optimize it yourself. Use STRAIGHT_JOIN and USE INDEX as found here in the manual: http://de

RE: Help with query performance anomaly (SOLVED)

2004-11-12 Thread Graham Cossey
It turns out that it appears to be a data discrepancy that caused the query optimiser to, well, not optimise. I thought the main table (r) with 3million records would be the problem, but it was table p with 3100 records on the live server and 3082 records on my dev pc that caused the problem. Alt

RE: Help with query performance anomaly

2004-11-11 Thread Graham Cossey
[snip] > > Have just run 'top' on the live server... > > Before running the query I get: > > 13:56:09 up 45 days, 11:47, 1 user, load average: 0.00, 0.28, 0.44 > 24 processes: 23 sleeping, 1 running, 0 zombie, 0 stopped > CPU0 states: 0.0% user 0.0% system0.0% nice 0.0% iowait 100.0% >

RE: Help with query performance anomaly

2004-11-11 Thread Graham Cossey
^ Does not look good to me !! Comments? Advice? Thanks Graham > -Original Message- > From: Jamie Kinney [mailto:[EMAIL PROTECTED] > Sent: 11 November 2004 19:25 > To: Graham Cossey > Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED] > Subject: Re: Help with query performance ano

Re: Help with query performance anomaly

2004-11-11 Thread Jamie Kinney
How do the OS statistics look on both boxes. Do top, sar, vmstat or iostat show any CPU, memory or I/O performance issues? Does anything odd appear in the /var/log/messages file? -Jamie On Thu, 11 Nov 2004 18:42:48 -, Graham Cossey <[EMAIL PROTECTED]> wrote: > > > [big snip] > > > > > Th

RE: Help with query performance anomaly

2004-11-11 Thread Graham Cossey
[big snip] > > These are two different plans. Your development machine is using > the index > yr_mn_pc on the r table and is joining that table last. On your > production > server, the r table is joined second and is joined by the index PRIMARY. > Let me know how the ANALYZE TABLE I suggested in

RE: Help with query performance anomaly

2004-11-11 Thread SGreen
Response at end "Graham Cossey" <[EMAIL PROTECTED]> wrote on 11/11/2004 12:19:17 PM: > > Thanks Shaun > > > > EXPLAIN shows the same 'possible keys' for each table but 'key' and > > 'key-len' columns are different, as are the 'rows' as well of course. > > > > I guess this points to a probable

RE: Help with query performance anomaly

2004-11-11 Thread Graham Cossey
> Thanks Shaun > > EXPLAIN shows the same 'possible keys' for each table but 'key' and > 'key-len' columns are different, as are the 'rows' as well of course. > > I guess this points to a probable difference in key definitions? > > Can 2 installations with the same table definitions produce differe

RE: Help with query performance anomaly

2004-11-11 Thread SGreen
ke this? Maybe something in the configs? > > Thanks > > Graham > > > -Original Message- > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > > Sent: 11 November 2004 16:28 > > To: Graham Cossey > > Cc: [EMAIL PROTECTED] > > Subject: Re

RE: Help with query performance anomaly

2004-11-11 Thread Graham Cossey
le definitions produce different results like this? Maybe something in the configs? Thanks Graham > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: 11 November 2004 16:28 > To: Graham Cossey > Cc: [EMAIL PROTECTED] > Subject: Re: Help with

Re: Help with query performance anomaly

2004-11-11 Thread SGreen
What does EXPLAIN show for the query on both systems? (I am wondering if you may have an index on your development system that you do not have on your production server.) Shawn Green Database Administrator Unimin Corporation - Spruce Pine "Graham Cossey" <[EMAIL PROTECTED]> wrote on 11/11/200

Re: Help with query

2004-10-27 Thread Ronan Lucio
Shawn, Thank you very for your answer. Actually, I thought that a main SELECT couldn´t be filtered by the WHERE clause refered to a field in a LEFT JOIN. Now, looking better in the JOIN documentation I see this issue. Thank´s, Ronan This is a very FAQ: SELECT t1.* FROM TABLE_1 t1 LE

Re: Help with query

2004-10-27 Thread SGreen
This is a very FAQ: SELECT t1.* FROM TABLE_1 t1 LEFT JOIN TABLE_2 t2 ON t1.id = t2.table1_id WHERE t2.id is null Shawn Green Database Administrator Unimin Corporation - Spruce Pine "Ronan Lucio" <[EMAIL PROTECTED]> wrote on 10/27/2004 10:12:42 AM: > Hi, > > I have two tables: > > TAB

Re: Help with query

2004-10-27 Thread Jigal van Hemert
SELECT `TABLE_1`.* FROM `TABLE_1` JOIN `TABLE_2` USING (`id`) WHERE `TABLE_2`.`id` IS NULL Asuming that the "reference" is the id field... Regards, Jigal. - Original Message - From: "Ronan Lucio" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, October 27, 2004 3:12 PM Subject

Re: Help with query

2004-09-10 Thread Ronan Lucio
Shawn > SELECT CityName, Count(ClientID) as ClientCount > FROM City > INNER JOIN Client > on City.CityID = Client.CityID > GROUP BY CityName > HAVING ClientCount > 30; Thank you very much, It should solve by problem... :-) Ronan -- MySQL General Mailing List For list archives: http:/

Re: Help with query

2004-09-10 Thread SGreen
SELECT CityName, Count(ClientID) as ClientCount FROM City INNER JOIN Client on City.CityID = Client.CityID GROUP BY CityName HAVING ClientCount > 30; Shawn Green Database Administrator Unimin Corporation - Spruce Pine "Ronan Lucio" <[EMAIL PROTECTED]> wrote on 09/10/2004 11:14:37 AM: >

Re: Help with query

2004-02-06 Thread David Hodgkinson
On 6 Feb 2004, at 14:38, Erich Beyrent wrote: This seems really efficient, since the only large number of rows to search against is the main listings table, if I read this right. Is there any further optimization that I can do, or this as good as it gets? Believe me, I am NOT complaining!!! Yes,

RE: Help with query

2004-02-06 Thread Erich Beyrent
the WHERE clause, right? > > Thanks! > > -Erich- > > > -Original Message- > From: Schwartz, Evelyn [mailto:[EMAIL PROTECTED] > Sent: Friday, February 06, 2004 8:53 AM > To: [EMAIL PROTECTED]; [EMAIL PROT

RE: Help with query

2004-02-06 Thread Schwartz, Evelyn
From: Erich Beyrent [mailto:[EMAIL PROTECTED] Sent: Fri 2/6/2004 9:00 AM To: [EMAIL PROTECTED] Cc: Subject: RE: Help with query Hi Evelyn, How would I do that - would something like this be what you had in mind?

RE: Help with query

2004-02-06 Thread Erich Beyrent
, February 06, 2004 8:53 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: Help with query You will need parentheses around the 'or' clauses of your where clause. You also don't seem to join the categories table with any other tables. If you don't join tables you

RE: Help with query

2004-02-06 Thread Schwartz, Evelyn
You will need parentheses around the 'or' clauses of your where clause. You also don't seem to join the categories table with any other tables. If you don't join tables you will create what is called a 'cross product' query. If table A has 10 rows and table B has 20 rows then querying A and

Re: Help with Query

2004-01-06 Thread robert_rowe
Try single quotes around instead of double quotes. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

Re: Help with Query

2004-01-06 Thread Michael Stassen
Jay Blanchard wrote: [snip] $query = "SELECT empnum,name,hdate,Photo,(YEAR(Curdate()) - YEAR(hdate)) as timein FROM emp2 where mo nth(hdate)=$mymonth and empnum < "" order by timein"; [/snip] Change to single quotes around data $query = "SELECT empnum,name,hdate,Photo,(YEAR(Curdate()) - YEA

RE: Help with Query

2004-01-06 Thread Jay Blanchard
[snip] $query = "SELECT empnum,name,hdate,Photo,(YEAR(Curdate()) - YEAR(hdate)) as timein FROM emp2 where mo nth(hdate)=$mymonth and empnum < "" order by timein"; [/snip] Change to single quotes around data $query = "SELECT empnum,name,hdate,Photo,(YEAR(Curdate()) - YEAR(hdate)) as timein FR

Re: Help with Query

2003-03-19 Thread Daren Cotter
Thanks, this works great in the MySQL server...I guess I've never used temp tables before, but when I try to run this in a PHP script, I get "table does not exist". How do I do this? --- Harald Fuchs <[EMAIL PROTECTED]> wrote: > In article > <[EMAIL PROTECTED]>, > Daren Cotter <[EMAIL PROTECTED]>

Re: Help with Query

2003-03-18 Thread Zak Greant
On Mon, Mar 17, 2003 at 10:47:09PM -0800, Daren Cotter wrote: > This seems to be doing the same thing as the > previously mentioned query...simply listing all > mailing IDs, along with the # of members it was sent > to. I've included both queries with their results > below. Hi Daren, Heh. T

Re: Help with Query

2003-03-18 Thread Jeff Shapiro
OK, attempt number two: Let's see what you are after is the number of emails that a member has received (say 25), and then you also want the number of members that have received x-number (say 25) emails. Is this even close to what you want? I think the only way to answer the question(s) is to

Re: Help with Query

2003-03-17 Thread Daren Cotter
This seems to be doing the same thing as the previously mentioned query...simply listing all mailing IDs, along with the # of members it was sent to. I've included both queries with their results below. mysql> SELECT COUNT(member_id), COUNT(mailing_id) FROM member_mailings GROUP BY mailing_id; +--

Re: Help with Query

2003-03-17 Thread Zak Greant
On Mon, Mar 17, 2003 at 09:52:44PM -0800, Daren Cotter wrote: > Jeff, > > That query simply gives me each mailing ID, along with > the # of members associated with that mailing ID. > > What I NEED is to return the # of mailings sent to a > member, and the number of members associated with that >

Re: Help with Query

2003-03-17 Thread Daren Cotter
Jeff, That query simply gives me each mailing ID, along with the # of members associated with that mailing ID. What I NEED is to return the # of mailings sent to a member, and the number of members associated with that number. I.e., if I do: SELECT count(*) FROM member_mailings WHERE member_id

Re: Help with Query

2003-03-17 Thread Jeff Shapiro
This should get you close: SELECT mail_id, count(member_id) AS `# of members` FROM yourtable GROUP BY mail_id; At 18:44 -0800 3/17/03, Daren Cotter wrote: I have a table that keeps track of when members of my site are mailed. The important fields in the table are: member_id, mail_id I need to writ

Re: help with query

2003-01-24 Thread Roger Baklund
* Justin French > I have four (relevant) tables: > > category > partner(pid,pname,etc) > service(sid,sname,cid) > sid2pid(sid,pid) > > > This works fine, listing all services available within a category: > > SELECT service.sid,service.sname > FROM service > WHERE cid='3' > ORDER BY service.sname AS

Re: help with query

2003-01-14 Thread Roger Baklund
* Leonardo Javier Belén > Thanks but actually I'm looking for a way to return all the relations > upwards and downwards of a term. no matter the position (so I need general > query to do that. Any ideas? > > >0100 - Rose tree > >0101 - pink rose tree > >0102 - red rose tree > >0103 - rococo rose tr

Re: help with query

2003-01-14 Thread Leonardo Javier Belén
nt: Tuesday, January 14, 2003 11:30 AM Subject: Re: help with query Hi Leo, how about this: select * from planttable where id like "01%" or id like "%02" CH Leonardo Javier Belén wrote: >Thanks but actually I'm looking for a way to return all the relations >upwar

Re: help with query

2003-01-14 Thread CH Tsang
ery to do that. Any ideas? Thanks in advance. Leo. - Original Message - From: "Anthony Richardson" < To: "Leonardo Javier BelÈn" <[EMAIL PROTECTED]> Sent: Monday, January 13, 2003 9:52 PM Subject: Re: help with query Hi, I do not clearly understand your q

Re: help with query

2003-01-14 Thread Leonardo Javier Belén
o Javier BelÈn" <[EMAIL PROTECTED]> Sent: Monday, January 13, 2003 9:52 PM Subject: Re: help with query Hi, I do not clearly understand your question, but if it's looking for query, please try the following: select * from planttable where substring(id, 1, 2)="01" and subs

RE: help with query

2003-01-13 Thread Kenneth Hylton
>From you example, not quite sure what you are trying to do (I could if, for example generic tree was 0199, and 01 was tree and last two characters were color or something like that) At any rate, you can use string functions to pull data from portions of fields to build whatever you want to search

Re: help with query

2003-01-13 Thread Gelu Gogancea
Hi, SELECT LEFT(YOUR_COLUMN,2) FROM YOUR_TABLE.for position SELECT RIGHT(YOUR_COLUMN,2) FROM YOUR_TABLE for type Regards, Gelu _ G.NET SOFTWARE COMPANY Permanent e-mail address : [EMAIL PROTECTED]

Re: help with query

2002-06-16 Thread Zak Greant
On Fri, 2002-06-14 at 18:16, Hathaway, Scott L wrote: > I am trying to get something like the following: > > Title > - > topic #1 > sub topic #1.1 > topic #2 > sub topic #2.1 > sub topic #2.2 > > from the following table (I am using php for scripting). > >

Re: help with query

2002-06-14 Thread Nick Stuart
I think the best way to do this is to set up two tables. One for the main topic list, then one for each sub topic. You may already have this but I cant see it here. Anyways to get your selection order correct you could do something like:SELECT * FROM forum ORDER BY parent_id, id Have any exampls

Re: help with query, pelase

2002-04-04 Thread Michael Zimmermann
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 At Donnerstag, 4. April 2002 17:57 Hathaway, Scott L wrote: > Yes, that should only cause a reordering within the group itself, but in my > case, the group breaks into two groups! Your 'group by' clause needs to have the same fields (and in the same

RE: help with query, pelase

2002-04-04 Thread Hathaway, Scott L
Yes, that should only cause a reordering within the group itself, but in my case, the group breaks into two groups! Scott -Original Message- From: Michael Zimmermann [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 04, 2002 8:58 AM To: Hathaway, Scott L; Mysql (E-mail) Subject: Re: help

Re: help with query, pelase

2002-04-04 Thread Michael Zimmermann
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 At Donnerstag, 4. April 2002 15:29 Hathaway, Scott L wrote: > I have the following query: > > select *, max(event_date) as high, min(event_date) as low from schedule > where event_date between '2002-03-01' and '2003-04-30' group by > week_ending,meeti

Re: Help with Query Syntax?

2001-01-29 Thread Roger Ramirez
Hmmm... Looks like you over did the query to me. This should work. SELECT o.OrderID, c.CustomerFirst, c.CustomerLast, s.SalesRepFirst, s.SalesRepLast FROM Orders as o, Customers as C, SalesReps as s WHERE O.CustomerPhone=c.CustomerPhone AND o.SalesRepID=s.SalesRepID of course you don't need the