Re: [sqlite] [SQLITE]select from a table and use its data to select from another one

2018-09-15 Thread Maziar Parsijani
Hi, Really thanks to all with your complete answers. The best answer is from Keith Medcalf. On Sat, Sep 15, 2018 at 1:45 AM Rob Richardson wrote: > Double quotes can be used to specify that you mean a database object when > the name of the object might be confused with a keyword. For example,

Re: [sqlite] [SQLITE]select from a table and use its data to select from another one

2018-09-14 Thread Rob Richardson
Double quotes can be used to specify that you mean a database object when the name of the object might be confused with a keyword. For example, my company's database models a production system with various recipes. We call them "cycles". But the word "cycle" appears to have some specific

Re: [sqlite] [SQLITE]select from a table and use its data to select from another one

2018-09-14 Thread Rob Richardson
The use of single quotes instead of double quotes in database queries is not limited to SQLite. That's part of the SQL standard. RobR On Fri, Sep 14, 2018 at 2:05 PM David Raymond wrote: > Small typo: > > SELECT * FROM table2 JOIN table1 > ON table1.rowid = table2.rowid > WHERE

Re: [sqlite] [SQLITE]select from a table and use its data to select from another one

2018-09-14 Thread Keith Medcalf
If you ONLY want columns returned from table2 then: select table2.* from table2 join table1 on table2.rowid = table1.rowid where table1.name like '%smth%'; which is really the same thing as: select table2.* from table2, table1 where table2.rowid = table1.rowid and table1.name

Re: [sqlite] [SQLITE]select from a table and use its data to select from another one

2018-09-14 Thread Maziar Parsijani
Hi, Thanks for your answer.I used your answer like this : SELECT * FROM table2 JOIN table1 on table1.rowid = table2.rowid WHERE table1.name LIKE '%smth%' Because without the "table1 on" statement it didn't work . On Fri, Sep 14, 2018 at 10:29 PM Simon Slavin wrote: > On 14 Sep

Re: [sqlite] [SQLITE]select from a table and use its data to select from another one

2018-09-14 Thread David Raymond
Small typo: SELECT * FROM table2 JOIN table1 ON table1.rowid = table2.rowid WHERE table1.name LIKE '%smth%' -Original Message- From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] On Behalf Of Simon Slavin Sent: Friday, September 14, 2018 1:59 PM To: SQLite

Re: [sqlite] [SQLITE]select from a table and use its data to select from another one

2018-09-14 Thread Simon Slavin
On 14 Sep 2018, at 6:50pm, Maziar Parsijani wrote: > I have 2 tables with the same rowid now I want to : > select rowid from table1 where table1 like "%smth%" > select * from table2 where rowid =(selected rows before) > > I mean if I could do it in a same query. This is what JOIN is for.