Forum Moderators: open

Message Too Old, No Replies

Simple select query, but I am STUCK!

select from two different tables

         

tabish

3:21 pm on Dec 20, 2006 (gmt 0)

10+ Year Member



Hello All,

I am using Mysql Database.

1)I have two tables named A and B
2)in Table A i have few fields like username,dob,city,country,resume,level

3) On table B I have fields like username,title,description

Now! What i want is:

I have to select username,title,description from table B and dob,city,country from Table A where username is same in two tables and title and decription should not be empty in table B and it should be order by level (from table A)

I am really stuck:(

Help me please.
Regards

FalseDawn

3:37 pm on Dec 20, 2006 (gmt 0)

10+ Year Member



SELECT B.username,B.title,B.description,A.dob,A.city,A.country FROM table_a A INNER JOIN table_b B ON A.username=B.username WHERE B.title IS NOT NULL AND B.description IS NOT NULL ORDER BY A.level

I've assumed your 2 tables are called something a bit more meaningful than "A" and "B" and have aliased them as A,B in the query.

tabish

5:40 pm on Dec 20, 2006 (gmt 0)

10+ Year Member



Thank you so much. it is working like charm.

Many thanx buddy.