Jump to content

how to select multi tables


ctcp

Recommended Posts

You are going to need to define what you want to do more.

 

You could be doing this limitation in the PHP side of your application.

 

If you really want to do it in SQL you could probably do something like this:

 

SELECT *
FROM table2
WHERE ( SELECT credits FROM table1 ) > 0

 

~juddster

SELECT User, credits, links
FROM table1 t1
JOIN table2 t2 ON t1.User = t2.user
WHERE t1.credits > 0

 

~juddster

 

 

Column 'credits' in field list is ambiguous

 

Not according to the table definition you provided us.

 

Please do not skip small details when providing us information because it just makes the responses you get back not as useful as they can be.

 

SELECT t1.User, t1.credits, t2.links
FROM table1 t1
JOIN table2 t2 ON t1.User = t2.user
WHERE t1.credits > 0 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.