UNION - different result when statements interchanged

2005-08-05 Thread Kapoor, Nishikant
I have a UNION whose statements when interchanged gives a different result. I can understand the change in the order of the rows, but how is it that 'picture' gets the correct value in (a) but not in (b)? Here are the two queries and their results: (a) (SELECT u.lName last_name, u.picture

SQL query taking a long time

2005-08-02 Thread Kapoor, Nishikant
Following query is taking a long time (upto 10 secs) to return the resultset. Would greatly appreciate if someone could help me understand why. I have run 'analyze table tablename' on all the three tables involved. The EXPLAIN output, record count and table description is also included. SELECT

RE: SQL query taking a long time...please

2005-08-02 Thread Kapoor, Nishikant
Just wondering if someone would be kind enough to take a look at it - Nishi -Original Message- Following query is taking a long time (upto 10 secs) to return the resultset. Would greatly appreciate if someone could help me understand why. I have run 'analyze table tablename' on

RE: SQL query taking a long time...please

2005-08-02 Thread Kapoor, Nishikant
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 02, 2005 3:14 PM To: Kapoor, Nishikant Cc: mysql@lists.mysql.com Subject: RE: SQL query taking a long time...please Kapoor, Nishikant [EMAIL PROTECTED] wrote on 08/02/2005 02:58:08 PM: Just

date comparison question

2005-08-01 Thread Kapoor, Nishikant
I am probably missing something very simple, but appreciate it if someone could point me to that. I am doing this query on following table to fetch recs for a month: SELECT fName, lName, acctOpenDate FROM test WHERE acctOpenDate = '2005-07-01' AND acctOpenDate = '2005-07-31'; I expect to see

Re: Ordinal number within a table

2005-06-28 Thread Kapoor, Nishikant
[Sorry for cross-posting.] This is in continuation with the above mentioned subject - I am trying to find the 'display data order' for the returned resultset. The following thread very well answers my question: http://lists.mysql.com/mysql/185626 a) SET @row=0; b) SELECT (@row:[EMAIL

RE: Ordinal number within a table

2005-06-28 Thread Kapoor, Nishikant
-Original Message- This is in continuation with the above mentioned subject - I am trying to find the 'display data order' for the returned resultset. The following thread very well answers my question: http://lists.mysql.com/mysql/185626 a) SET @row=0; b) SELECT

need help in sql query

2004-07-21 Thread Kapoor, Nishikant
Hello List, I have a problem that I am looking your help for. Would greatly appreciate it. Here is what I am trying to do: create table C (cId tinyint(4), cName varchar(10)); insert into C values (1,'Cat01'), (2,'Cat02'), (3,'Cat03'), (4,'Cat04'); create table SC (scId tinyint(4), cId

How to get count(id) when count is zero?

2004-07-02 Thread Kapoor, Nishikant
Hello List, It sounds like a simple query but I have spent quite a few hours already, and still do not have a solution. Would greatly appreciate your response. Here is what I am trying to do: --- create table C (cId tinyint(4) NOT NULL); insert into C values (1),