This is a discussion on How can i write this query:-urgent within the SQL Server 2005 Tutorials forums, part of the Articles and Tutorials category; hi all, i hav a table called members that holds the details of members like name and address. And i ...
|
|||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
How can i write this query:-urgent
hi all,
i hav a table called members that holds the details of members like name and address. And i hav another table called interest that contain interst id,member_id, interst1, interst2,interest3. Lot of members into that table( morethan 10,000+). A member can select maximum three interest. i want to check when a new member come , then need to check, similar interessted members. and also need to take the count of each members common interest with the new comer interst. plz help me...with query... plz tell me the solution.. with details. plz helppppppp |
|
|||
|
GUPTHA,Thanks for u'r reply.
But here i hav 2 tables: 1. Member table: mem_id,mem_name,mem_addr 2. Interest table: int_id,mem_id,int1,int2,int3 I want to check , wen a new member comes in,then need to check ,how many similar interst for each member comparing with that new member. plz reply me |
|
|||
|
1. You will not be able to find until the new member select atleast one of his interest.
2. You will have to write dynamic query internally that will fire when the new member selects his interest (I dont know on what application you are working on or which language you are using) example if you are using check box to allow user to select his interest, then the proper event is checkbox_onclick() / checkbox_onchange - use which ever is suitable. When this event occurs, you need to execute internal query and retrieve records of members having similar interest SELECT mem_name FROM [member table] WHERE mem_id IN (SELECT DISTINCT mem_id FROM [INTEREST Table] WHERE int1 = Chechbox_value OR int2 = Checkbox_value OR int3 = Checkbox_value) You have to assign proper value to checkbox so as to co-relate with interest table int1 int2 int3 values You can write above query in more than one way - that is just an example, you will have to choose the one that achieves best performance at all the times |
|
|||
|
SQl query
hi Haneesh,
i saw your quote. and the solution provided by " Guptha_S ", is no doubt a good and appropriate solution for your query, even i was about to give the same solution for that. If any replies or suggestion you are most welcome. Thank you Jitesh Programmer Sharepoint Consulting |
![]() |
| Thread Tools | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to find second max sal of employee with the co | chandraismoon | Oracle Tutorials | 7 | 05-16-2008 04:08 AM |
| What is an Ad Hoc Query | lokeshm | Data Warehousing | 0 | 01-31-2008 06:53 AM |
| how do i write a query in coldfusion? | gogbpackrs2 | Coldfusion | 2 | 05-21-2007 11:47 AM |
| comp.lang.c Answers (Abridged) to Frequently Asked Questions (FAQ) | Steve Summit | Tech FAQ | 0 | 06-01-2004 07:01 AM |
| comp.lang.c Answers to Frequently Asked Questions (FAQ List) | Steve Summit | Tech FAQ | 0 | 06-01-2004 07:00 AM |