Help me on complex queries ???

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
PHPycho
Forum Contributor
Posts: 336
Joined: Fri Jan 06, 2006 12:37 pm

Help me on complex queries ???

Post by PHPycho »

Can anybody guide in

* Selecting certain fields from two or more tables with certain things common

* deleting from two or more tables having common id

thanks in advance..................
User avatar
neel_basu
Forum Contributor
Posts: 454
Joined: Wed Dec 06, 2006 9:33 am
Location: Picnic Garden, Kolkata, India

Post by neel_basu »

If I Understand Your Question I Think mysqli_multi_query() Is your Answer
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

I think PHPycho is referring to JOINs neel_basu.

Typically selecting elements from two or more tables requires a JOIN. Otherwise it's one query per table.

Foreign key constructs can perform deletes across tables, as can simply deleting from each table separately. Some databases support multiple table deletes, but you'll need to look at their manual for that information.
User avatar
neel_basu
Forum Contributor
Posts: 454
Joined: Wed Dec 06, 2006 9:33 am
Location: Picnic Garden, Kolkata, India

Post by neel_basu »

feyd wrote:I think PHPycho is referring to JOINs neel_basu.
Ya Thats Also Possible It Would Be Good If PHPycho Explain his Problem
User avatar
PHPycho
Forum Contributor
Posts: 336
Joined: Fri Jan 06, 2006 12:37 pm

Post by PHPycho »

Thanks for the replies..................
Actually i wanna select or delete from two or more tables having a common id in a single query...............
Please help me on those queries by specifying illustrations...
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Those are JOINs. Please search; we have many many many examples all over the place.
Post Reply