SQL query

Results 1 to 3 of 3

Thread: SQL query

  1. #1
    Join Date
    Dec 1969

    Default SQL query

    Hello, <BR>I have the same field in two different tables which will be having diferent values. I need to write a SQL statement which selects the values by comparing both the tables but the same field. how do i write it? <BR>I can make it still more clear...i have a table which contains old jobs which is identifies by job code and one more table with new jobs again identifies by job code. i have to display the search results according to the jobcode which matches the criteria. how can i write the SQL statement to achieve what i want? <BR><BR>Thanks, <BR>keerthi

  2. #2
    Eddie Campbell Guest

    Default RE: SQL query

    Use a union query:<BR><BR>"Select OldJobs.JobCode, OldJobs.JobName From OldJobs<BR>Union Select NewJobs.JobCode, NewJobs.JobName From NewJobs<BR>Where JobCode = 53"<BR><BR>Remeber that the fields returned from each table MUST match. If they have different fieldnames, you will need to use an alias.

  3. #3
    Join Date
    Dec 1969

    Default RE: SQL query

    Try INNER JOIN.<BR><BR>Sample:(This is for selecting a specificate ID [tra_id])<BR><BR>SELECT Translation.tra_id, Translation.author, TranslationData.* FROM Translation <BR>INNER JOIN TranslationData ON Translation.tra_id = TranslationData.tra_id <BR>WHERE (((Translation.tra_id)=" & tra_id

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts