Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7169389
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:58:45+00:00 2026-05-28T14:58:45+00:00

I have these tables in my database: Contacts -contact_id -contact_name File -file_id -file_code -customer_id

  • 0

I have these tables in my database:

Contacts
   -contact_id
   -contact_name

File
   -file_id
   -file_code
   -customer_id
   -hauler_id

File_details
   -file_id
   -loadunload_id
   -loadunload_date
   -loadunload_time

LoadUnload
   -loadunload_id
   -loadunload_place

And these inputs as search fields on my webpage. Results are sent through Ajax, the whole system will run in an offline local network:

"File Code" (file.file_code)
"Customer Name" (contacts.contact_name)
"Hauler name" (contacts.contact_name)
"Load place" (loadunload.loadunload_place)
"Load date" (loadunload.loadunload_date)
"Unload place" (loadunload.loadunload_place)
"Unload date" (loadunload.loadunload_date)

Which should get me the following results on my screen:

File Code | Customer | Load place | Load time | Unload place | Unload time | Weight | Hauler

One filled in search field should show a result as wel as multiple filled in search fields. All I really need is my file.file_id. With that I can show everything else I need in my html table, but I don’t have a single clue how my SQL should look like. My guess is I need about a million joins in my sql?

I’ve attached a link with a screenshot, which may make things easier to understand. Screenshot link

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T14:58:47+00:00Added an answer on May 28, 2026 at 2:58 pm

    Assuming that File.customers_id is the foreign key for Contacts.contact_id, the sql should be:

    SELECT *
    FROM File AS f
        JOIN Contacts AS c ON (f.customers_id = c.contact_id)
        JOIN File_details AS fd ON (fd.file_id = f.file_id)
        JOIN LoadUnload AS l ON (fd.loadunload_id = l.loadunload_id)
    

    This should return all entries. For filtering add a WHERE clause:

    WHERE f.file_code = '<filecode>' AND ...
    

    Hope this helps

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following tables, with these keys in my database: bookings session_id sessions
So I have these two tables in my database: Companies -------------------- CompanyID (PK) Name
I have a database, with several tables. The main table, called contacts , stores
Say I have a database called Poll and have these two table structures. poll
I have an existing database with tables which each have 4 partitions (there are
I've 3 different database tables that have the same 5 fields but those does
i have a stack of messages in database table. i want to send these
I have a MySQL database set-up in a hierarchy style. There are 4 tables
We have two tables in a SQL Server 2005 database, A and B.There is
In database I have Contacts table: ContactID (int) FirstName (varchar) LastName (varchar) ... XmlFields

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.