Paul,
The example I gave was a join :-) In SQL, doing:
SELECT * FROM table1, table2 WHERE table1.id = table2.table1id
is an implicit inner join, and evaluates the same as:
SELECT * FROM table1
INNER JOIN table2
ON table1.id = table2.table1id
So, pretty much the most advanced joining you can do with the basic
db.select is:
db.select(['table1', 'table2'], where='table1.id = table2.table1id')
Hope this helps!
-Justin
On May 1, 4:08 pm, Paul Jobs <[EMAIL PROTECTED]> wrote:
> can u give an example or using join in db.select
> Justin Davis wrote:You can use select to do basic implicit joins by passing
> it a list of tables, but for anything more complicated, and you should use
> db.query. For example: db.select(['table1', 'table2'], where='table1.id =
> table2.table1id') Thats creates this sql: SELECT * FROM table1, table2 WHERE
> table1.id = table2.table1id -Justin On May 1, 4:02 am, "paul jobs"<[EMAIL
> PROTECTED]>wrote:join query: feeds=db.query('select feeds.*,users.profilepic
> from feeds* join users on feeds.userid=users.id *where userid in (select
> friend_id from friends where myid=$userid) order by id desc limit
> 20',vars=locals()) select query:
> feeds=db.select('feeds',where='id=$i.id',vars=locals()) is there a way to use
> joins with db.select thanks for any help Paul
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web.py" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---