you basically have a one (note) to many (note type) relationship.

model this with two tables --

create table notes (id integer primary key);

create table note_types (note_id integer references notes, type integer);

to add a type to a note, insert into note_types. to find out whether 
a note is of a particular type, or to get all the types for a 
particular note, select from note_types.



>Hi guys,
>I have a column which describes note type, the value of the type may
>be 1, 2, 3.....(some int numbers). The problem is that the type value
>may be one of those numbers, or some of the numbers, such as the type
>may belong to1 and also belong to 2..
>When I create the table, I may create it like this:
>"CREATE TABLE " + NOTES_TABLE_NAME + " ("
>                     + Notes._ID + " INTEGER PRIMARY KEY,"
>                     + Notes.TYPE + " TEXT"
>                     + ");");
>I set "TEXT" to Notes.TYPE, so it can save the type '1 and 2' like
>this "1,2", But when I query the item whose Notes.TYPE is "1", you
>know, type "1,2" also satisfys this, And I should do some string
>spliting in order to query this.
>Is there any easy way to solve this?
>Thanks!
>

-- 
jason.software.particle

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to