View previous topic :: View next topic
|
Author |
Message |
anu2 Warnings : 1 New User
Joined: 10 Jun 2007 Posts: 36 Location: Chennai
|
|
|
|
Hi,
Suppose in a table there are some records which
having two common column values.
Say in a employee table i have some records where emplyee name is
Hary and salary is 5000, so i want to retrieve all those records.
Please let me know.
Regards,
anu. |
|
Back to top |
|
|
stodolas
Active Member
Joined: 13 Jun 2007 Posts: 632 Location: Wisconsin
|
|
|
|
This is a basic SQL query from a single table. It doesn't match your "tables" statement in the topic. How are multiple tables involved. Please clarify your question. |
|
Back to top |
|
|
psreddy Currently Banned New User
Joined: 18 May 2006 Posts: 4
|
|
|
|
Hi,
Did you try this...
Select * from Employee.
Correct me if I wrong...
Thanks,
PsReddy |
|
Back to top |
|
|
logeswarank Warnings : 1 New User
Joined: 15 Oct 2006 Posts: 22 Location: Chennai
|
|
|
|
Hi,
Try this one
Use Group by clause then use the SALARY = 5000
If any mistake let me know i'll correct |
|
Back to top |
|
|
stodolas
Active Member
Joined: 13 Jun 2007 Posts: 632 Location: Wisconsin
|
|
|
|
Quote: |
Suppose in a table there are some records which
having two common column values.
Say in a employee table i have some records where emplyee name is
Hary and salary is 5000, so i want to retrieve all those records.
Please let me know.
|
This is such basic SQL....
Code: |
SELECT COL1, COL2, COL3, COL....
FROM empTable
WHERE name = 'Hary' AND salary = 5000
|
|
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
Select * from Employee.
Correct me if I wrong... |
This is wrong. . . This will select everyting in the table. . .
Quote: |
Try this one
Use Group by clause then use the SALARY = 5000
If any mistake let me know i'll correct |
There is no need for GROUP BY. . . The requirement was to read rows matching certain criteria. . .
Please refer to Steve's SELECT. |
|
Back to top |
|
|
|