473,503 Members | 1,858 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Select items with same catehory as given item

Hey

I have two tables:

TABLE_ARTICLE
article_id******article_name article_content

TABLE_ARTICLE_SECTION
article_id *section_id
Given an article_id, how do I select all articles from
TABLE_ARTICLE that have the same section_id as that of a given
article_id.

Something like this but for mysql:
SELECT table_article.* FROM table_article,table_section WHERE
table_section.section_id IN (SELECT section_id FROM table_section
WHERE article_id="something")

Thanks
Joshua
Jul 19 '05 #1
2 1581
BDR
select * from TABLE_ARTICLE
LEFT JOIN TABLE_ARTICLE_SECTION ON
(TABLE_ARTICLE.article_id=TABLE_ARTICLE_SECTION.ar ticle_id)
WHERE TABLE_ARTICLE.article_id='something'

Check mysql.com for other variants on this same theme... "table JOIN(s)"
http://www.mysql.com/doc/en/JOIN.html

Jadow wrote:
Hey

I have two tables:

TABLE_ARTICLE
article_id article_name article_content

TABLE_ARTICLE_SECTION
article_id section_id
Given an article_id, how do I select all articles from
TABLE_ARTICLE that have the same section_id as that of a given
article_id.

Something like this but for mysql:
SELECT table_article.* FROM table_article,table_section WHERE
table_section.section_id IN (SELECT section_id FROM table_section
WHERE article_id="something")

Thanks
Joshua


Jul 19 '05 #2
BDR
select * from TABLE_ARTICLE
LEFT JOIN TABLE_ARTICLE_SECTION ON
(TABLE_ARTICLE.article_id=TABLE_ARTICLE_SECTION.ar ticle_id)
WHERE TABLE_ARTICLE.article_id='something'

Check mysql.com for other variants on this same theme... "table JOIN(s)"
http://www.mysql.com/doc/en/JOIN.html

Jadow wrote:
Hey

I have two tables:

TABLE_ARTICLE
article_id article_name article_content

TABLE_ARTICLE_SECTION
article_id section_id
Given an article_id, how do I select all articles from
TABLE_ARTICLE that have the same section_id as that of a given
article_id.

Something like this but for mysql:
SELECT table_article.* FROM table_article,table_section WHERE
table_section.section_id IN (SELECT section_id FROM table_section
WHERE article_id="something")

Thanks
Joshua


Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
13043
by: Charlotte Henkle | last post by:
Hello; I'm pondering how to count the number of times an item appears in total in a nested list. For example: myList=,,] I'd like to know that a appeared three times, and b appeared twice,...
0
460
by: Jadow | last post by:
Hey I have two tables: TABLE_ARTICLE article_id      article_name article_content TABLE_ARTICLE_SECTION article_id  section_id
4
11249
by: headware | last post by:
I have a <select> control that contains many entries. It allows the user to multi-select a group of them, click a button, and store the selected data in a database. Normally they do this starting...
6
4268
by: Ben Hallert | last post by:
Hi guys, I'm trying to figure out what bone headed mistake I made on something I put together. I've got a form (named 'context') that has a variable number of select-multiple inputs on it. ...
13
2781
by: andro | last post by:
Hi everybody! I have several tables from which I want to exract the SAME value (along with other referenced data). All the values are in the same column within the tables. How can I achieve...
5
10061
by: Phill W. | last post by:
(VB'2003) What's the correct way to remove multiple, selected items from a ListView control (say, from a ContextMenu)? I ask because I'm getting a very annoying ArgumentOutOfRangeException...
3
6413
by: Beholder | last post by:
I hope that someone can help me with the following: Short background explenation: I have a shrfepoint page (newform.aspx) in a item list. On this page is a lookup column that displays a lookup...
1
4009
by: Sunray | last post by:
I have a form called the sales form and i have 2 sets of listboxes So what happens is. i add items form the bottom set of list boxes which are bound to a data base to the top set of list boxes which...
2
2809
by: phpnewbie26 | last post by:
I currently have two drop down menus where the second one is populated from the first one. My second drop down menu should be able to do multiple selection. I have searched online and found out how...
0
7280
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7330
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6991
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5578
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4672
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3167
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3154
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1512
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
736
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.