Query needed for this sol.

2007-04-08 Thread abhishek jain

Hi all,
I need a query for the fol. sol.
In a table i have 100s of rows with six categories like A,B,C,D,E,F which is
marked with a column like
Table
ID Category
1   A
2   A
3  B
4   B
5  B
6 C
7 C

and so on 100 ids for each of six categories , i want to delete all but 10
ids of each category, i wanted to know how to do so,

Pl. help
Thanks,
Abhishek jain


Re: How can I do something like this in mySQL...

2007-04-08 Thread John Kopanas

Sweet... thanks guys... it is working well now :-).

On 4/8/07, Mogens Melander [EMAIL PROTECTED] wrote:

Well, maybe you want to read up on isnull() and case (..) in the manual.
It's in there, somewhere.

mysql SELECT CASE 1 WHEN 1 THEN 'one'
- WHEN 2 THEN 'two' ELSE 'more' END;
- 'one'
mysql SELECT CASE WHEN 10 THEN 'true' ELSE 'false' END;
- 'true'
mysql SELECT CASE BINARY 'B'
- WHEN 'a' THEN 1 WHEN 'b' THEN 2 END;
- NULL

IF(expr1,expr2,expr3)

If expr1 is TRUE (expr1  0 and expr1  NULL) then IF() returns expr2;
otherwise it returns expr3. IF() returns a numeric or string value,
depending on the context in which it is used.

mysql SELECT IF(12,2,3);
- 3
mysql SELECT IF(12,'yes','no');
- 'yes'
mysql SELECT IF(STRCMP('test','test1'),'no','yes');
- 'no'

IFNULL(expr1,expr2)

If expr1 is not NULL, IFNULL() returns expr1; otherwise it returns expr2.
IFNULL() returns a numeric or string value, depending on the context in
which it is used.

mysql SELECT IFNULL(1,0);
- 1
mysql SELECT IFNULL(NULL,10);
- 10
mysql SELECT IFNULL(1/0,10);
- 10
mysql SELECT IFNULL(1/0,'yes');
- 'yes'


--
Later

Mogens Melander
+45 40 85 71 38
+66 870 133 224


On Sat, April 7, 2007 20:19, John Kopanas wrote:
 I have a query that looks something like this:

 SELECT (c_o_w_inst_rev - c_o_w_estcost)/c_o_w_inst_rev
 FROM tmpGovernmentSummaries

 The problem is that sometimes c_o_w_inst_rev is 0 and dividing by zero
 returns a NULL.

 If c_o_w_inst_rev == 0 how can I return 0 for the SELECT above instead
 of NULL?  Can I test in the SELECT if c_o_w_inst_rev is 0 and return 0
 and if not do the math?

 Insight would be greatly appreciated :-)


 --
 John Kopanas
 [EMAIL PROTECTED]

 http://www.kopanas.com
 http://www.cusec.net
 http://www.soen.info

 --
 MySQL General Mailing List
 For list archives: http://lists.mysql.com/mysql
 To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


 --
 This message has been scanned for viruses and
 dangerous content by OpenProtect(http://www.openprotect.com), and is
 believed to be clean.




--
This message has been scanned for viruses and
dangerous content by OpenProtect(http://www.openprotect.com), and is
believed to be clean.


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]





--
John Kopanas
[EMAIL PROTECTED]

http://www.kopanas.com
http://www.cusec.net
http://www.soen.info

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Why is the Falcon license listed as 'PROPRIETARY' in 5.2.3?

2007-04-08 Thread Baron Schwartz

Greetings,

On 5.2.3:

select plugin_name, plugin_license from plugins;
+-++
| plugin_name | plugin_license |
+-++
| binlog  | GPL|
| partition   | GPL|
| ARCHIVE | GPL|
| BLACKHOLE   | GPL|
| CSV | GPL|
| Falcon  | PROPRIETARY|
| FEDERATED   | GPL|
| MEMORY  | GPL|
| InnoDB  | GPL|
| MyISAM  | GPL|
| MRG_MYISAM  | GPL|
| ndbcluster  | GPL|
+-++

Why is Falcon listed as PROPRIETARY?  I assume that won't be the eventual 
license when it's finished.  Is it just work in-progress to make it GPL or 
something?


Regards
Baron

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Replication among disconnected Servers

2007-04-08 Thread Ravi Kumar.

Can any one help me please?

Ravi Kumar. wrote:

Hi All,

We have a MySQL 5.0 server (master) running on Windows. For backup, I 
wish to setup another system with same version of MySQL to act as 
backup / slave. But this slave can not have direct access to the 
master. Is there a way I can achive this? I do not wish to take a full 
dump in master. Would it work, if I take the binary replication logs 
manually from master and provide it to slave? Any other way to 
achieve desired results.


Thanks,

Ravi.




--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]