Re: Complex Select Query

2010-08-25 Thread Ashish Mukherjee
r > > > - > > > > -Original Message- > > >From: Victor Subervi > > >Sent: Aug 24, 2010 1:14 PM > > >To: mysql@lists.mysql.com > > >Subject: Complex Select Query > > > > > >Hi; > > >I have the

Re: Complex Select Query

2010-08-24 Thread Victor Subervi
ice. TIA. Victor > - > > -Original Message- > >From: Victor Subervi > >Sent: Aug 24, 2010 1:14 PM > >To: mysql@lists.mysql.com > >Subject: Complex Select Query > > > >Hi; > >I have the following query: > > > >select * from spr

Re: Complex Select Query

2010-08-24 Thread Peter Brawley
It's a tree. See http://www.artfulsoftware.com/mysqlbook/sampler/mysqled1ch20.html and http://www.artfulsoftware.com/infotree/treequeryperformance.pdf. PB - -Original Message- >From: Victor Subervi >Sent: Aug 24, 2010 1:14 PM >To: mysql@lists.mysql.com >Subject: C

Complex Select Query

2010-08-24 Thread Victor Subervi
Hi; I have the following query: select * from spreadsheets s join products p on p.Item=s.Item join categories c on p.Category=c.ID where s.Client=%s order by p.category, c.parent; mysql> describe products; +-+--+--+-+-++ | Field | Type

Re: Complex SELECT

2008-09-22 Thread Andre Matos
It worked like a charm. Thanks for the help! Andre On 22-Sep-08, at 2:58 PM, Jim Lyons wrote: look at using the "group_concat" function on OptionalDesc and group by the other fields. On Mon, Sep 22, 2008 at 1:40 PM, Andre Matos <[EMAIL PROTECTED] > wrote: Hello, I need help with a SQL

Re: Complex SELECT

2008-09-22 Thread Jim Lyons
look at using the "group_concat" function on OptionalDesc and group by the other fields. On Mon, Sep 22, 2008 at 1:40 PM, Andre Matos <[EMAIL PROTECTED]>wrote: > Hello, > > I need help with a SQL Select statement: > > I have three tables: report, category, and optional > > a) "report" table has 3

Complex SELECT

2008-09-22 Thread Andre Matos
Hello, I need help with a SQL Select statement: I have three tables: report, category, and optional a) "report" table has 3 fields: ReportId, CategoryId, ReportDesc b) "category" table has 2 fields: CategoryId, CategoryDesc c) "optional" table has three fields: OptionalId, CategoryId, Opti

Re: Complex select across multiple tables

2005-11-16 Thread SGreen
Scott Haneda <[EMAIL PROTECTED]> wrote on 11/16/2005 05:44:05 AM: > Some of these tables are rather large, I would put the schema in there, but > I think it just adds to the mess. > > Tables > `users` field id is auto inc pk > `orders` field id is auto inc pk > `products` field id is auto inc pk

Complex select across multiple tables

2005-11-16 Thread Scott Haneda
Some of these tables are rather large, I would put the schema in there, but I think it just adds to the mess. Tables `users` field id is auto inc pk `orders` field id is auto inc pk `products` field id is auto inc pk `order_items` field order_id is the key for hooking up order_items to orders, al

Re: Error in Complex SELECT

2004-12-28 Thread Christopher Fulton
I believe your problem is that versions of MySQL prior to 4.1 (i think) do not allow subqueries. You may try rewriting your query as a join. On Tue, 28 Dec 2004 12:14:06 -0600, Adam Ernst <[EMAIL PROTECTED]> wrote: > I'm trying to do the following SELECT statement: > > SELECT * FROM matches WHE

Error in Complex SELECT

2004-12-28 Thread Adam Ernst
I'm trying to do the following SELECT statement: SELECT * FROM matches WHERE question_id = ANY (SELECT server_id FROM questions WHERE results_id = 'MyID') I've tried rephrasing it as: SELECT * FROM matches WHERE question_id IN (SELECT server_id FROM questions WHERE questions.results_id = 'MyID')

RE: Complex select statement

2003-07-16 Thread Rudy Metzger
] Subject: RE: Complex select statement Still having a problem with this. Still have one last thing that isn't working. This is MySQL 4.0.13. UPDATE table_tmp,table2_daily SET table_tmp.period_count = table_tmp.count - table2.count WHERE table_tmp.id = table2.id AND MAX(table2.timestamp);

RE: Complex select statement

2003-07-15 Thread Roy Walker
ilto:[EMAIL PROTECTED] Sent: Tuesday, July 15, 2003 4:27 PM To: [EMAIL PROTECTED] Subject: Re: Complex select statement As far as I know, MAX only returns the greatest row, so what you really want at the end is WHERE table_tmp.id=table2.id AND table2.timestamp=MAX(table2.timestamp) ~MJI Roy W

Re: Complex select statement

2003-07-15 Thread Michael Iatauro
As far as I know, MAX only returns the greatest row, so what you really want at the end is WHERE table_tmp.id=table2.id AND table2.timestamp=MAX(table2.timestamp) ~MJI Roy Walker wrote: Still having a problem with this. Still have one last thing that isn't working. This is MySQL 4.0.13. UPDAT

RE: Complex select statement

2003-07-15 Thread Roy Walker
ow to do it 4.1! Please! :) Roy -Original Message- From: Rudy Metzger [mailto:[EMAIL PROTECTED] Sent: Monday, July 14, 2003 3:49 AM To: Roy Walker; [EMAIL PROTECTED] Subject: RE: Complex select statement I never heard before that you can use a select statement in an arithmetic expression. Onl

RE: Complex select statement

2003-07-14 Thread Rudy Metzger
ld also be the way how I would do it in a different DB (e.g. ORACLE). Cheers /rudy -Original Message- From: Roy Walker [mailto:[EMAIL PROTECTED] Sent: vrijdag 11 juli 2003 18:30 To: [EMAIL PROTECTED] Subject: RE: Complex select statement Eva, Thanx for your help. Still having an issue

Re: Complex select statement

2003-07-11 Thread Nils Valentin
st regards Nils Valentin Tokyo/Japan > > Thanx, > Roy > > -Original Message- > From: "Paracková Eva, Ing" [mailto:[EMAIL PROTECTED] > Sent: Friday, July 11, 2003 12:30 AM > To: Roy Walker > Subject: RE: Complex select statement > > try this: > >

RE: Complex select statement

2003-07-11 Thread Roy Walker
ge- From: Egor Egorov [mailto:[EMAIL PROTECTED] Sent: Friday, July 11, 2003 11:52 AM To: [EMAIL PROTECTED] Subject: Re: Complex select statement "Roy Walker" <[EMAIL PROTECTED]> wrote: > > Thanx for your help. Still having an issue with this. I forgot to ment

Re: Complex select statement

2003-07-11 Thread Egor Egorov
"Roy Walker" <[EMAIL PROTECTED]> wrote: > > Thanx for your help. Still having an issue with this. I forgot to mention I am > running MySQL 4.0.13. Tried both of these statements: > > INSERT INTO table2 (id,count,period_count,date) SELECT id as id1, count, (count - > (SELECT count FROM table2

RE: Complex select statement

2003-07-11 Thread Roy Walker
for the 'SELECT count FROM table2 WHERE id=id1' section. Is this illegal syntax? Would this be considered a subselect? Thanx, Roy -Original Message- From: "Paracková Eva, Ing" [mailto:[EMAIL PROTECTED] Sent: Friday, July 11, 2003 12:30 AM To: Roy Walker Subject

Complex select statement

2003-07-10 Thread Roy Walker
If anyone could tell me what I am doing wrong here, I would greatly appreaciate it. Have the following tables: table1: id, count table2: id, count, period_count, date, timestamp Trying to do the following; get all rows from table 1 and insert them into table2 while setting period_count to co

RE: Help with a semi-complex select statement..

2001-05-23 Thread Ravi Raman
s.PLAYERID order by TPM desc limit 10; (this may or may not work/parse properly, as i didn't actually try it, YMMV, etc.etc.etc.) -ravi. -Original Message- From: Chad Day [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 23, 2001 10:59 AM To: [EMAIL PROTECTED] Subject: Help with a semi

Help with a semi-complex select statement..

2001-05-23 Thread Chad Day
I have 4 tables, named: players - stores player id, name, team id teams - teamid, teamname goals - goals scored, player id, team id penalty - penaltys accumulated, player id What I'm trying to do is write a query to get the top 10 from any category and display them. I can do them individually f