Problem with SQL Statement

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
krsm1980
Forum Commoner
Posts: 25
Joined: Sat Jan 09, 2010 12:33 am
Location: IN
Contact:

Problem with SQL Statement

Post by krsm1980 »

Hi guys,

I have one problem,

Table A (contains 100 records), just one identifier
Table B (contains 500 records), just two identifiers

What i want is, there must be a SQL statement....which offer me

It must take first record from TABLE A, and check that into Table B...if exists then display that records there. and the show must continue till 100 records (till Tables moves to end)

Plz help me finding such statement i can execute as SQL statement.

many thanks in advance.
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: Problem with SQL Statement

Post by VladSun »

What have you tried so far? Post your queries.
There are 10 types of people in this world, those who understand binary and those who don't
User avatar
krsm1980
Forum Commoner
Posts: 25
Joined: Sat Jan 09, 2010 12:33 am
Location: IN
Contact:

Re: Problem with SQL Statement

Post by krsm1980 »

I havent tried anything yet....

i just to want to get one statement, with which i can perform above mentioned task.

It must take one record from TAB A, and move into TAB B, and search for it till end. then next and search for it....and LOOP continues...

at last it must tell me which are the records; not available in TAB B
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: Problem with SQL Statement

Post by VladSun »

OK, write something, try it and return for help... Here in this forum, we help people to get solutions, we don't provide them ...
There are 10 types of people in this world, those who understand binary and those who don't
User avatar
Darhazer
DevNet Resident
Posts: 1011
Joined: Thu May 14, 2009 3:00 pm
Location: HellCity, Bulgaria

Re: Problem with SQL Statement

Post by Darhazer »

VladSun, you can give starting direction. Frankly, I didn't expect such posts from you :)

krsm1980, this seems like simple inner join - show all posts from table b that match to identifier in table a :)
Try it.
And if it's not exactly what you are looking for, provide a samle input (which means samle rows in database) and output, to illustrate your needs.
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: Problem with SQL Statement

Post by VladSun »

You are right. Probably a bad mood ...
There are 10 types of people in this world, those who understand binary and those who don't
Post Reply