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

  • Home
  • SEARCH
  • 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 5937707
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:34:50+00:00 2026-05-22T15:34:50+00:00

I am very stressful with Sql coding. Any solution please help…. I have tables

  • 0

I am very stressful with Sql coding. Any solution please help….
I have tables like below :

  OrderedFood(**TableID,FoodID**,Qty,OrderedDate)
  Invoices(**InvoiceID**,TableID,Amount)
  InvoiceDetail(**InvoiceID,FoodID**,Qty,orderedDate)

I want to copy OrderedFood.TableID => Invoices.TableID. then copy OrderedFood.FoodID => InvoiceDetail.FoodID , OrderedFood.Qty => InvoiceDetail.Qty which this content a lot of rows.

How could i do it ?

Thanks in advance …

  • 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-22T15:34:51+00:00Added an answer on May 22, 2026 at 3:34 pm

    I’m afraid it is a bit hard to understand exactly what you are trying to do.
    Hopefully the following SQL can help point you in the right direction

    DECLARE @OrderedFood Table(TableID int ,FoodID int ,Qty int ,OrderedDate datetime)
    DECLARE @Invoices Table(InvoiceID int IDENTITY(1,1)PRIMARY KEY CLUSTERED, TableID int ,Amount money)
    DECLARE @InvoiceDetail Table(InvoiceID int,FoodID int,Qty int ,orderedDate datetime)
    
    insert into @orderedfood values(1,1,1,'2010/05/21')
    insert into @orderedfood values(1,2,3,'2010/05/21')
    insert into @orderedfood values(1,3,2,'2010/05/21')
    insert into @orderedfood values(2,1,4,'2010/05/21')
    insert into @orderedfood values(2,2,2,'2010/05/21')
    
    insert into @Invoices(TableId) SELECT distinct TableId From @OrderedFood
    
    Insert into @InvoiceDetail(InvoiceID,FoodID,Qty,orderedDate)
    SELECT InvoiceID,FoodId,Qty,OrderedDate 
    FROM @OrderedFood o
    inner join @Invoices i on o.tableid = i.tableid
    
    select * from @invoices i inner join @invoicedetail id on i.invoiceid = id.invoiceid
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

very basic question, but is there any ToArray-like function for c# linked lists that
Very simple but didn't have enough time to do a quick search. Kindly help
Very simplified, I have two tables Source and Target. declare @Source table (SourceID int
Very simply put: I have a class that consists mostly of static public members,
Very simply put, I have the following code snippet: FILE* test = fopen(C:\\core.u, w);
Very simple question, is there any cloud server enviroments avaliable these days for us
Not very technical, but... I have to implement a bad words filter in a
Very basic question about iPhone memory management: Say I have a viewController with several
Very often I want to join two ascii-files, which are both tables in the
Very rusty with my Python. I have a list of Cost as strings. I'm

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.