×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Apr 2009
    Posts
    2

    In module e32db , how can i use " where ..in .."

    I had created a table in my database , and i want to select data from it using sql .I want to use the model "SELECT Student_name FROM Student_information WHERE Student_id IN (...)".If I had a list of student_id ,how can i complete the SELECT sentence .
    In original SQL sentence it would be "SELECT Student_name FROM Student_information WHERE Student_id IN (08012,08014,08015)".
    thank you !

  2. #2
    Nokia Developer Champion
    Join Date
    Feb 2008
    Location
    Ahmedabad, Gujarat, India
    Posts
    3,852

    Re: In module e32db , how can i use " where ..in .."

    Quote Originally Posted by yesl08 View Post
    I had created a table in my database , and i want to select data from it using sql .I want to use the model "SELECT Student_name FROM Student_information WHERE Student_id IN (...)".If I had a list of student_id ,how can i complete the SELECT sentence .
    In original SQL sentence it would be "SELECT Student_name FROM Student_information WHERE Student_id IN (08012,08014,08015)".
    thank you !
    hello yesl08

    the only thing i can do to help you is give you this article at the wiki which contain some basic information about database in PyS60.

    Regards
    Gaba88

  3. #3
    Regular Contributor
    Join Date
    Nov 2007
    Posts
    147

    Re: In module e32db , how can i use " where ..in .."

    One way I overcame this issue by creating a helper that translates (1,2,3,4,5....) into OR statements on the fly (in the data layer of my app). So

    Code:
    select * from customers where customer_id in (1,2,3,4,5)
    would become:

    Code:
    select * from customers where customer_id = 1 or customer_id = 2 or customer_id = 3 or customer_id = 4 or customer_id = 5
    Surprisingly there is not much of a penalty performance and the where string can be quite long. I managed to build a where clause with 100 or so OR statements in it.

    Btw, are you trying to overcome the issue of missing inner joins with this?

    raf

  4. #4
    Registered User
    Join Date
    Apr 2009
    Posts
    2

    Re: In module e32db , how can i use " where ..in .."

    Quote Originally Posted by raf1hh View Post
    One way I overcame this issue by creating a helper that translates (1,2,3,4,5....) into OR statements on the fly (in the data layer of my app). So

    Code:
    select * from customers where customer_id in (1,2,3,4,5)
    would become:

    Code:
    select * from customers where customer_id = 1 or customer_id = 2 or customer_id = 3 or customer_id = 4 or customer_id = 5
    Surprisingly there is not much of a penalty performance and the where string can be quite long. I managed to build a where clause with 100 or so OR statements in it.

    Btw, are you trying to overcome the issue of missing inner joins with this?

    raf
    First of all , thanks for your help.
    but how I know the length of the helper ,which is not a constant ? The list may be different each time when the function is called ?

  5. #5
    Regular Contributor
    Join Date
    Nov 2007
    Posts
    147

    Re: In module e32db , how can i use " where ..in .."

    Sorry. What I ment is this:

    In my application I have implemented the ActiveRecord pattern. All database access goes through the data-access-layer classes and this gives me ability to be creative with the queries. So even though I can't do inner joins I can get the results I need by building complex OR statements.

    Thats where the helper comes in. It's really just a simple function, you pass it an array of ids and the name of the column and out comes a sql where clause...

    rafael

Similar Threads

  1. Buggy AMR Audio Recording. Please Help!!
    By jhamby in forum Symbian
    Replies: 8
    Last Post: 2009-07-07, 10:34
  2. Replies: 4
    Last Post: 2009-07-07, 10:07
  3. How to create a sis using ensymble and Python 1.9.4 ?
    By marcelobarrosalmeida in forum Symbian
    Replies: 10
    Last Post: 2009-05-27, 10:16
  4. Replies: 9
    Last Post: 2008-08-30, 07:05
  5. Carbide.j 1.5 and Netbeans 5.5 beta 2
    By ovjo12 in forum Mobile Java Tools & SDKs
    Replies: 5
    Last Post: 2007-06-11, 05:43

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×