[sqlite] help with query

2016-04-06 Thread e-mail mgbg25171
Simon... Yes I forgot the "where sn.nm='std1';" restriction and... also see you've used 2 inner joins. Thank you very much for your thoroughness. It's very much appreciated. > > On 06 April 2016 at 12:41 Simon Davies > wrote: > > > On 6 April 2016 at 12:22, e-mail mgbg25171 > wrot

[sqlite] help with query

2016-04-06 Thread Simon Davies
On 6 April 2016 at 12:22, e-mail mgbg25171 wrote: > Here are my tables specified as... tbl_nm | col1, col2... > std_nms | id, nm > raw_nms | id, nm > nm_pairs | id, std_nms_id, raw_nms_id > > I'm wondering how to supply a single std_nms.nm and get back a list of pairs > i.e. std_nm.nm, raw_nms.nm

[sqlite] help with query

2016-04-06 Thread e-mail mgbg25171
Here are my tables specified as... tbl_nm | col1, col2... std_nms | id, nm raw_nms | id, nm nm_pairs | id, std_nms_id, raw_nms_id I'm wondering how to supply a single std_nms.nm and get back a list of pairs i.e. std_nm.nm, raw_nms.nm that reflect each record in nm_pairs with a std_nms_id = std

Re: [sqlite] help with query

2015-01-14 Thread snowbiwan
Maybe something like this would work for you: SELECT * FROM table WHERE data1 IN (SELECT data1 FROM table GROUP BY data1 HAVING count(*)>=3); ~snowbiwan -- View this message in context: http://sqlite.1065341.n5.nabble.com/help-with-query-t

Re: [sqlite] help with query

2015-01-13 Thread Keith Medcalf
.@sqlite.org [mailto:sqlite-users- >boun...@sqlite.org] On Behalf Of Hajo Locke >Sent: Tuesday, 13 January, 2015 00:30 >To: sqlite-users@sqlite.org >Subject: [sqlite] help with query > >Hello list, > >i have a problem finding right query, hope you can help me. >I have a sampl

Re: [sqlite] help with query

2015-01-13 Thread Hajo Locke
t() AS count FROM table GROUP BY data1 HAVING count >= 3)); -Ursprüngliche Nachricht- Von: Hajo Locke [mailto:hajo.lo...@gmx.de] Gesendet: Dienstag, 13. Jänner 2015 08:30 An: sqlite-users@sqlite.org Betreff: [sqlite] help with query Hello list, i have a problem finding right query,

Re: [sqlite] help with query

2015-01-13 Thread Hick Gunter
..@gmx.de] Gesendet: Dienstag, 13. Jänner 2015 08:30 An: sqlite-users@sqlite.org Betreff: [sqlite] help with query Hello list, i have a problem finding right query, hope you can help me. I have a sample table like this: http://pastebin.com/8qyBzdhH I want to select all lines where at least 3 lines

[sqlite] help with query

2015-01-12 Thread Hajo Locke
Hello list, i have a problem finding right query, hope you can help me. I have a sample table like this: http://pastebin.com/8qyBzdhH I want to select all lines where at least 3 lines in column data1 have same value. My expected result-set ist this: http://pastebin.com/UcaXLVx9 How can this be

Re: [sqlite] Help with query

2010-11-15 Thread Jeff Archer
>From: Drake Wilson Sun, November 14, 2010 7:50:19 AM >> SELECT COUNT(Offset_Y) FROM (SELECT DISTINCT Offset_Y FROM Tiles WHERE >>PatternID >> >> = 1); >> >> Is it possible to have a single query that will generate a row for each >> PattenID, COUNT(Offset_Y) combination? > >Does SELECT Pattern

Re: [sqlite] Help with query

2010-11-14 Thread Drake Wilson
Quoth Jeff Archer , on 2010-11-13 11:20:51 -0800: > And I can get the number of unique Y offsets in a pattern like so: > > SELECT COUNT(Offset_Y) FROM (SELECT DISTINCT Offset_Y FROM Tiles WHERE > PatternID > = 1); > > Is it possible to have a single query that will generate a row for each > P

[sqlite] Help with query

2010-11-14 Thread Jeff Archer
I have a table CREATE TABLE [Tiles] ( TileID    INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, PatternID INTEGER NOT NULL REFERENCES [Patterns] DEFERRABLE INITIALLY DEFERRED, Offset_X  REAL NOT NULL DEFAULT 0.0, Offset_Y  REAL NOT NULL DEFAULT 0.0 ); And I can get the number of uniq

Re: [sqlite] Help with query

2008-04-08 Thread P Kishor
On 4/8/08, Neville Franks <[EMAIL PROTECTED]> wrote: > Thanks Igor and Puneet, > These are very different solutions, or so it appears to me. > > Any idea whether the join or the sub-select would be faster? In my > example there is an index on tagid. Just as in any language, SQL also gives many

Re: [sqlite] Help with query

2008-04-08 Thread Neville Franks
Thanks Igor and Puneet, These are very different solutions, or so it appears to me. Any idea whether the join or the sub-select would be faster? In my example there is an index on tagid. Wednesday, April 9, 2008, 8:12:53 AM, you wrote: IT> Neville Franks <[EMAIL PROTECTED]> wrote: >> I have a

Re: [sqlite] Help with query

2008-04-08 Thread Igor Tandetnik
Neville Franks <[EMAIL PROTECTED]> wrote: > I have a table that holds 1 to many items. To keep it simple say it > has 2 columns: tagid and noteid. A given tagid can have many noteid's. > ex. > tagid noteid > -- -- > a 1 > a 4 > a 7 > b 7 > b 3 > c 1 >

Re: [sqlite] Help with query

2008-04-08 Thread P Kishor
On 4/8/08, Neville Franks <[EMAIL PROTECTED]> wrote: > I have a table that holds 1 to many items. To keep it simple say it > has 2 columns: tagid and noteid. A given tagid can have many noteid's. > ex. > tagid noteid > -- -- > a 1 > a 4 > a 7 > b 7 > b

[sqlite] Help with query

2008-04-08 Thread Neville Franks
I have a table that holds 1 to many items. To keep it simple say it has 2 columns: tagid and noteid. A given tagid can have many noteid's. ex. tagid noteid -- -- a 1 a 4 a 7 b 7 b 3 c 1 I want to perform a query: give me all noteid's that have tagid a

Re: [sqlite] Help with query

2004-10-09 Thread Brian Pugh
Fred, A query I can understand! This was my attempt, and worked to some degree, but yours is more workable and, I feel, more accurate "select NewsData.Postcode,NewsData.Address1,Agents.Code,Agents.Shopname,Agents.Addre ss1.Agents.Price from NewsData join Agents on NewsData.Postcode where NewsDat

Re: [sqlite] Help with query

2004-10-08 Thread Fred Bleuzet
Without testing on my side... how's that? select a.Shop1, a.Shop2, a.Postcode, b.Code, b.Shopname, b.Address1, b.Price from NewsData a, Agents b where (a.Shop1 > '' or a.Shop2 > '') and b.Shopname > '' and (a.Shop1 = b.Shopname or a.Shop2 = b.Shopname) order by a.Postcode asc On Fri, 8 Oct 2004

[sqlite] Help with query

2004-10-08 Thread Brian Pugh
Hi, This query, "select distinct Shop1,Shop2,Postcode from NewsData where Shop1>'' or Shop2>'' order by Postcode asc" works as I require, but I want to expand the query to include data from another table, and have got a bit stuck The second table is called Agents. If the above query is successf