Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

The Database Forum


You are currently viewing our The Database Forum as a guest. Please register to participate.
Login



Reply
Old 10-18-2010, 11:38 AM how to select ?
Super Talker

Posts: 134
Trades: 0
i have a table of 2 columns

ex.

col1 col2
1 2
1 3
1 4
2 1
2 3
2 4
3 1
3 2

now i want to select all values of col2 that two different values of col1 have in common. for example the two values of col1 1 and 3 will give one value --> 2 because 1 and 3 in col1 have the value 2 in col2 in common.

How to do this ?
__________________

Please login or register to view this content. Registration is FREE

Check out the Facebook Clone build with Jcow SNS at
Please login or register to view this content. Registration is FREE
, it is free and it always will be
Falcone is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 10-20-2010, 08:35 AM Re: how to select ?
cindyfowler's Avatar
Ultra Talker

Posts: 351
Trades: 0
I wonder if you could explain your meaning more clearly,that would be very nice.I can sure that you can select the appropriate data from tables if you run the right select query language.
cindyfowler is offline
Reply With Quote
View Public Profile
 
Old 10-20-2010, 04:07 PM Re: how to select ?
Banned

Posts: 5
Trades: 0
what are you using? phpmyadmin?
mrzett is offline
Reply With Quote
View Public Profile
 
Old 10-20-2010, 04:30 PM Re: how to select ?
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Assuming I have understood what you want, (which is very doubtful because it's pretty vague). You can't.

It will need a stored procedure.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 10-23-2010, 07:48 AM Re: how to select ?
Super Talker

Posts: 134
Trades: 0
i found a solution myself

SELECT t1.col2 FROM `mytable` as t1 inner join `mytable` as t2 on t1.col2 = t2.col2 where t1.col1 = val1 and t2.col2 = val2

now the result of this select needs to be joined with a second table where t1.col2 is linked with the primary key of the second table.

how do this ?
__________________

Please login or register to view this content. Registration is FREE

Check out the Facebook Clone build with Jcow SNS at
Please login or register to view this content. Registration is FREE
, it is free and it always will be
Falcone is offline
Reply With Quote
View Public Profile
 
Old 10-28-2010, 01:25 PM Re: how to select ?
Extreme Talker

Posts: 206
Name: vikas
Trades: 0
the query above should work for you ...
__________________

Please login or register to view this content. Registration is FREE
Collection of free online books and free ebooks
Please login or register to view this content. Registration is FREE
- Free online pdf books and free pdf eBooks
vikas1234 is offline
Reply With Quote
View Public Profile
 
Old 11-01-2010, 05:06 AM Re: how to select ?
Average Talker

Posts: 22
Name: Neha Nayak
Trades: 0
I think query suggested by Falcone really works.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
nehacct is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to how to select ?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.31992 seconds with 12 queries