Joining tow tables with subset of columns from one

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Joining tow tables with subset of columns from one

Paul Sanderson
I want to join two table by doing a select in the form

select col1, col2, col3 from table1 as t1, * from table2 as t2 where
t1.col1 = t2.x

I appareciate that this is invalid sql, but is this possible, can i use a
wild card in this way (or similar)
_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Joining tow tables with subset of columns from one

Kevin Martin

On 13 Mar 2013, at 17:44, Paul Sanderson wrote:

> I want to join two table by doing a select in the form
>
> select col1, col2, col3 from table1 as t1, * from table2 as t2 where
> t1.col1 = t2.x

Are you trying to do:

select t1.col1, t1.col2, t1.col3, t2.* from table1 as t1 join table2 as t2 on t1.col1=t2.x

If not, I'm not sure what you want to achieve.

Thanks,
Kevin

_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Joining tow tables with subset of columns from one

Paul Sanderson
Yes thanks Kevin

Dull question and I was just coming back here to say I have sorted it.

Thanks anyway :)


On 13 March 2013 17:59, Kevin Martin <[hidden email]> wrote:

>
> On 13 Mar 2013, at 17:44, Paul Sanderson wrote:
>
> > I want to join two table by doing a select in the form
> >
> > select col1, col2, col3 from table1 as t1, * from table2 as t2 where
> > t1.col1 = t2.x
>
> Are you trying to do:
>
> select t1.col1, t1.col2, t1.col3, t2.* from table1 as t1 join table2 as t2
> on t1.col1=t2.x
>
> If not, I'm not sure what you want to achieve.
>
> Thanks,
> Kevin
>
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



--
Paul
www.sandersonforensics.com
skype: r3scue193
twitter: @sandersonforens
Tel +44 (0)1326 572786
_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users