Re: [SQL] Duplicate records

2007-02-02 Thread Mezei Zoltán
Ezequias Rodrigues da Rocha wrote: Hi list, I am making some data minning and would like to know if someone tell me how to retrieve the duplicate records based in one or two fields of my table. Any help would be welcomed. You can use a simple query like this one: select t1.id, t2.id from t

[SQL] Grouping by day, limiting amounts

2006-10-19 Thread Mezei Zoltán
Hi, I didn't really know what subject I should give. I have a table like this one: 2006.10.01.    Bela    10 2006.10.01.    Aladar    9 2006.10.01.    Cecil    8 2006.10.01.    Dezso    7 2006.10.01.    Elemer    6 2006.10.02.    Bela    11 2006.10.02.    Aladar    10 2006.10.02.    Cecil  

Re: [SQL] Group by minute

2006-09-22 Thread Mezei Zoltán
Ezequias Rodrigues da Rocha wrote: Hil list, I have a query but my IDE (Delphi) does not accept "to_char" capability. Is there a way to reproduce the same query without using to_char function ? Here is my query: SELECT  to_char(quando,'dd/MM/ HH24:MI'),count(id) FROM base.tentativa

Re: [SQL] Count and list only where count is bigger than 1

2006-09-19 Thread Mezei Zoltán
Ezequias Rodrigues da Rocha wrote: SELECT distinct cli.bairro, COUNT( * ) as qtd FROM base.cliente cli GROUP BY cli.cidade, cli.bairro ORDER BY 2 I noticed that I cannot use "where qtd > 1" ok ? What to do ? Google/read tutorial for HAVING. E.g. SELECT distinct cli.bairro, COUNT( * )

Re: [SQL] Two optimization questions

2006-09-12 Thread Mezei Zoltán
Aaron Bono wrote: You could split it into sub-queries but would that make the performance better or worse? I guess it depends on how much data is there, and what frequency you have ot the event_type's but indexing the event_type column would help. This may be worth a try - use EXPLAIN to see

[SQL] Two optimization questions

2006-09-12 Thread Mezei Zoltán
Hi, I think it can be done better than I did and I want to learn... 1. I have a table that registers the history of messages: output_message_history(id, event_type, event_time) I need those ID-s from the table where there is one 'MESSAGE SENT' event and one 'MESSAGE SUBMITTED' event and there