Exforsys

Online Training

How can i write this query:-urgent

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 ...


Go Back   Exforsys > Articles and Tutorials > SQL Server 2005 Tutorials

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-21-2008, 02:10 AM
Junior Member
 
Join Date: Feb 2008
Posts: 2
Haneesh is on a distinguished road
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-21-2008, 07:41 AM
Member
 
Join Date: Jan 2006
Posts: 34
Guptha_S is on a distinguished road
You need to create a join between two tables using member_id
Once you create this join, you can retrive list of members with similar interest based on the interest selected by new member
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-22-2008, 12:22 AM
Junior Member
 
Join Date: Feb 2008
Posts: 2
Haneesh is on a distinguished road
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-22-2008, 04:33 AM
Member
 
Join Date: Jan 2006
Posts: 34
Guptha_S is on a distinguished road
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 02-25-2008, 04:10 AM
Junior Member
 
Join Date: Feb 2008
Posts: 1
dilipv is on a distinguished road
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads

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


All times are GMT -4. The time now is 02:20 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0
Copyright 2004 - 2007 Exforsys Inc. All rights reserved.