0

I'm struggling with sqlite query since 2 days in Android.

Here is details -

I've two table

  1. localeResource

  2. Banner table

Table structure is -

LocalResource - id, locale, key, value

Banner - bannerid, bannername, bannerimage, bannerlink, bannertext, countryid, bannerassociate

My query is like -

Working query -

select ban.bannerid,loc.value,ban.bannerimage,ban.bannerlink,ban.bannertext,ban.countryid,ban.bannerassociatedstyle from banner ban left outer join localeResources  loc on  loc.key = ban.bannername and loc.locale='FR';

But I wanted query like -

select ban.bannerid,loc.value,ban.bannerimage,ban.bannerlink,locs.value,ban.countryid,ban.bannerassociatedstyle from banner ban left outer join localeResources  loc, localeResources  locs on  loc.key = ban.bannername, locs.key = ban.bannertext and loc.locale='FR';

When I'm running second query my sqlite is hanging and crashing.

Please let me know what & where i'm missing.

1
  • What is the desired meaning? Must key match with both ban columns, or with one of them? Commented Jun 14, 2014 at 7:47

2 Answers 2

1

Your query is wrong:

This one should work:

    select ban.bannerid,loc.value,ban.bannerimage,ban.bannerlink,locs.value,ban.countryid,ban.bannerassociatedstyle 
   from banner ban left outer join localeResources  loc on loc.key = ban.bannername and loc.locale='FR'
   left outer join localeResources  locs on  locs.key = ban.bannertext ;

You have the on statement at the wrong place.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks Jens for your query, but it is showing duplicate value, and show ENG & French from outer side.
@Rakesh Can you add some sample data please?
0

Thanks Jens, based on your query, correct query is -

select ban.bannerid,loc.value,ban.bannerimage,ban.bannerlink,locs.value,ban.countryid,ban.bannerassociatedstyle from banner ban 
left outer join localeResources  loc on loc.key = ban.bannername and loc.locale='FR' left outer join localeResources  locs on  locs.key = ban.bannertext 
and locs.locale='FR';";

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.