SQLTeam.com | Weblogs | Forums

Checking SQL query


#1

Hi,

I have 2 tables registration , student
registration table includes regid, mobno, status
student table includes - studid, name, address, emailid, father , mother , fathermobno, mothermobno, smsno, other details....

In the registartion form , they have to give any of their mobile nos ( fathermobno, mothermobno, smsno)
and submit the form.
then i have to check whether the mobile number they entered at the time registration is matching with any of the mobile nos in the student table.

How i can check so? could any one help me the sql query for that?

Regards
Neethu


#2

We are glad to help with homework but you need to make some first steps:

  1. post the CREATE TABLE statements for all tables involved (registration, student)
  2. post INSERT INTO statements to populate both tables with sample data
  3. Attempt to write a query to perform the logic as described
  4. Post the results you get from your query
  5. Post the desired results from the query, using the tables and data from steps 1 and 2.

#3

Hint:
Have a looks at IF EXISTS () check in books online


#4

It takes a simple inner join between the columns in the two tables. They taught you how to do joins, didn't they?