Re: [sqlite] How to get the original rows after 'group by'?

2010-08-26 Thread Peng Yu
time)? On Thu, Aug 26, 2010 at 3:59 PM, David Bicking wrote: > you can use: > > select col1, col2 from test where col1 in (select col1 from test group by > col1 having count(*)<=2); > > David > > --- On Thu, 8/26/10, Peng Yu wrote: > >> From: Peng Yu >>

Re: [sqlite] How to get the original rows after 'group by'?

2010-08-26 Thread David Bicking
you can use: select col1, col2 from test where col1 in (select col1 from test group by col1 having count(*)<=2); David --- On Thu, 8/26/10, Peng Yu wrote: > From: Peng Yu > Subject: [sqlite] How to get the original rows after 'group by'? > To: "General Discussion

[sqlite] How to get the original rows after 'group by'?

2010-08-26 Thread Peng Yu
Hi, In the following sql query, I want to get all the lines which satisfies that the first column appears less or equal to 2 times. Is there a way to do it other than using inner join of the original table and the query in main.sql? $ cat main.sql #!/usr/bin/env bash #sqlite3 foods.db