Another SQL Question...

  EmBeZzLeR 18:10 30 May 03
Locked

Question: List manager's name with their staffs' names, positon and telephone numbers.

Table names: Sno, FName, LName, Address, Tel_No, Position, Sex, DOB, Salary, NIN and Bno

I'm not even sure how to start thing one and i know that it will be hard for you as you do not have the table i have in front of me.

If you have any idea how to go about doing this, please let me know by posting.

Thanks

  Taran 19:40 30 May 03

You've listed field names, not just one or more table names which complicates things just a tad.

SQL is as hard as you want to make it. To answer your question, you need to select the records to display from fieldname(s) and tablename(s) then display them in a useful format.

Here is an example of a very simple SQL query:

SELECT * FROM people WHERE firstname = 'Bob'

In plain English, this query selects all records (SELECT *) from the table called people (FROM people) where the firstname of Bob is stored (WHERE firstname = 'Bob').

I need exact table name(s) to compile an accurate query for you but an example based loosely on the details you have supplied could be along the lines of:

SELECT Sno,FName,LName,Address,Tel_No,Position,Sex,DOB,Salary,NIN,Bno FROM tablename

This example assumes that Sno, FName, LName, Address, Tel_No, Position, Sex, DOB, Salary, NIN and Bno are all field names in a table, and you obviously have to substitue the word tablename for the name of the table you are trying to select the records from.

You can get the general idea of the query and its structure from the above but a word of warning, if you are using Microsoft Access you may have to re-jig things a little. Microsoft, in their wisdom, chose not to use standard SQL for Access but implemented their own version of it, so some of the commands are slightly different although the structure remains broadly the same even if the syntax differs sometimes. You should be safe enough with such a simple query though.

If you are exact with your table name(s) and record field names I can give you the exact query you need, but it does need to be absolutely accurate.

SQL gives no error margins; if it doesn't do what it's supposed to do, it's the fault of how the query was written so you need to have those table and field names correct.

Hope this helps.

Regards

Taran

This thread is now locked and can not be replied to.

Best phone camera 2016/2017: Galaxy S7 vs iPhone 7 vs Google Pixel vs HTC 10 Evo vs OnePlus 3T vs…

1995-2015: How technology has changed the world in 20 years

The Pantone Colour of the Year 2017 is Green

Super Mario Run preview | Hands-on first impressions of Super Mario Run: Mario's iPhone & iPad…