Computer Forum  

Go Back   Computer Forum > Computer Forums > Programming Forum > Mysql Forum

Mysql Forum Mysql Forum


need in sql statement in mysql?

Mysql Forum

Mysql Forum


Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-06-2008, 01:24 AM
Junior Member
 
Join Date: Jun 2008
Posts: 1
benaya p RSS Feed
need in sql statement in mysql?

Hi,
I am want on sql statement for my table. I am having one table call friends in that table i will store userid and friendid like this.....


iUserID iFriendID
1 3
1 2
1 4
2 4
3 6
6 2
5 7
7 8

How can i get parent and child record suppose my id is 3 i have to get userid "3"'s parent records and child record. How can i get this all records....

1 3
1 2
1 4
2 4
3 6
6 2

Thanks in advance
when i query like this it will display..
select * from tbl_friend where (iUserID=3 or iFriendID=3)
iUserID iFriendID
1 3
3 6



Not like this i want when i query i want like this....

iUserID iFriendID
1 3
1 2
1 4
2 4
3 6
6 2
i want like this..
iUserID iFriendID
1 3
1 2
1 4
2 4
3 6
6 2
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Is the below statement true ? I read it on Wikipedia.? Zach Wikipedia Forum 8 07-12-2008 01:09 AM
Can anybody help me on this C++ program using switch case statement. And also... joycee C++ Forum 0 06-04-2008 02:49 AM
To build database using Mysql what is the best tool: Mysql query broswer or George Mysql Forum 1 05-18-2008 10:25 PM
where i have to place mysql driver in apache tomcat while connecting mysql sunny Mysql Forum 0 01-12-2008 06:54 PM
How to access MYSQL database Using PHP in Linux and how to configure Mysql and satya_ils Mysql Forum 0 01-08-2008 10:42 AM


All times are GMT. The time now is 08:27 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93