0

Hello,

i have a problem with my query. any body give suggestion please.

i have two tables named as "users" and "userimages"

in the users table there are
1)userid (primary key)
2)name
3)subscription package (Brong or gold)

and in the next table "userimages" fields are
1)auto_id
2)userid (foreign key)
3)image url.

now i want to display users order by "subscription packages" and display whose image urls are not null those user profiles display first.

thanks.

3
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by karthik_ppts
0

Use this query: -

select u.name, u.subscription_package, i.image_url from users as u LEFT JOIN userimages as i ON u.userid = i.userid where i.image_url != "" order by u.subscription_package

0

Always make a practise that, don't use space between your field name for e.g. subscription package should be subscription_package.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.