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 09-28-2007, 01:02 PM query in SQL
Junior Talker

Posts: 2
Name: tuan
Trades: 0
Hi veryone!
I have a difficluty about query, you can help me solve it. I need the help from you. my question is :

there are two tables with the following data:

M-Manufacturer(MID,MNAME,CITY)

MID MNAME CITY
M1 TOM sydney
M2 Mary Brisbane

P-PRODUCT(PID,PNAME,CITY)

PID PNAME CITY
P1 computer sydney
P2 CD-ROM Perth

Question :get all cities(CITY) in which at least one manufacturer or product.

I understand that according to the question and based on the data above, the result will include the following city : sydney, brishane, perth. this is union operator but I do not know which query in SQL to solve it. If you understand it, you can give me solution. thanks very much!
dientuan75 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 09-29-2007, 08:03 AM Re: query in SQL
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Homework?

http://www.w3schools.com/sql/sql_union.asp

BTW
Poor database design often leaves problems when trying to extract data from several tables.

A third table is required for the cities, then the city field in the other two tables should be a refrence to the ID of the entry in the city table.
That would make queries much simpler.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to query in SQL
 

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.68656 seconds with 12 queries