Query displaying redundant data for a menu item, menu has choices, but displays menu item multiple times with different choices

  • pietlinden - Tuesday, June 6, 2017 12:41 PM

    I'm turning into Joe Celko... time for a break.
    Please help us to help you and read this article. 

    Forum Etiquette: How to post data/code on a forum to get the best help

    --===== If the test table already exists, drop it
      IF OBJECT_ID('TempDB..#mytable','U') IS NOT NULL
       DROP TABLE #mytable

    --===== Create the test table with
    CREATE TABLE #mytable
       (
       Ticket.i_ticket_id (PK,int, not null),
       TicketItem.s_item (nvarchar(50), null),
       ChoiceItem.s_choice_name (nvarchar(50), not null),
       TicketItem.s_qty (char(9), null),
       ChoiceItem.i_ticket_item_id (PK,int, not null),
       Customers.cust_fullname (Computed, nvarchar(101), null),
       Employees.s_name (varchar(50), null)
       )

    SELECT 'SELECT '
      + QUOTENAME(Ticket.i_ticket_id,'''')+','
      + QUOTENAME(TicketItem.s_item,'''')+','
      + QUOTENAME(ChoiceItem.s_choice_name,'''')+','
      + QUOTENAME(TicketItem.s_qty,'''')+','
      + QUOTENAME(ChoiceItem.i_ticket_item_id,'''')+','
      + QUOTENAME(Customers.cust_fullname,'''')+','
      + QUOTENAME(Employees.s_name,'''')
      + ' UNION ALL'
    FROM yourtable

    --===== All Inserts into the IDENTITY column
      SET IDENTITY_INSERT #mytable ON

    --===== Insert the test data into the test table
    INSERT INTO #mytable
       (Ticket.i_ticket_id, TicketItem.s_item, ChoiceItem.s_choice_name, TicketItem.s_qty, ChoiceItem.i_ticket_item_id, Customers.cust_fullname, Employees.s_name)
    SELECT '129128','Cookies n Cream','Peach Tea Cold',1','577213','Brennan Hannah','Aubrianna Majewski' UNION ALL
    SELECT '129128','Cookies n Cream','Mango Aloe Shot','1','577213','Brennan Hannah','Aubrianna Majewski' UNION ALL
    SELECT '129128','Cookies n Cream','Peach Tea Cold','1','577214','Brennan Hannah','Aubrianna Majewski' UNION ALL
    SELECT '129128','Cookies n Cream','Mango Aloe Shot','1','577214','Brennan Hannah','Aubrianna Majewski' UNION ALL
    SELECT '129129','Cookies n Cream','Lemon Tea Cold','1','577215','Turcotte Riley','Aubrianna Majewski' UNION ALL
    SELECT '129129','Cookies n Cream','Mango Aloe Shot','1','577215','Turcotte Riley','Aubrianna Majewski' UNION ALL
    SELECT '129133','Liftoff','Orange Liftoff','1','577220    ','LATTUFE LARISSA','Aubrianna Majewski' UNION ALL
    SELECT '129134','PB Cheesecake','Chai Tea Hot','1','577221','Goncalo Alycia','Aubrianna Majewski' UNION ALL
    SELECT '129109','Tea & Aloe With Shake','Chai Tea Cold','1','577178','SOUZA SHERI','Isabella Tomlinson' UNION ALL
    SELECT '129109','Tea & Aloe With Shake','Cranberry Aloe Shot','1','577178','SOUZA SHERI','Isabella Tomlinson' UNION ALL
    SELECT '129140','Lemon Pound Cake','Lemon Tea Cold','1','577229','Cashara Evelyn','Mackenzie Reed' UNION ALL
    SELECT '129140','Lemon Pound Cake','Mango Aloe Shot','1','577229','Cashara Evelyn','Mackenzie Reed' UNION ALL
    SELECT '129136','Tea & Aloe','Lemon Tea Cold','1','577224','REED MACKENZIE','Mackenzie Reed' UNION ALL
    SELECT '129136','Tea & Aloe','Cranberry Aloe Shot','1','577224','REED MACKENZIE','Mackenzie Reed'

    --===== Set the identity insert back to normal
      SET IDENTITY_INSERT #mytable ON

    Correct?

  • Thanks for the effort, but that actually isn't quite what we need (right technique, but wrong content).

    We will need the structure of the underlying tables used by the query (Ticket, TicketItem, Customers, Employees, ChoiceItem), and sample data for those tables.

    The whole point is that we need to be able to see what the data you're querying is like so we can see how to address your issue and test variations of your query to see what will provide the results you desire.

    Cheers!

  • Jacob Wilkins - Tuesday, June 6, 2017 2:08 PM

    Thanks for the effort, but that actually isn't quite what we need (right technique, but wrong content).

    We will need the structure of the underlying tables used by the query (Ticket, TicketItem, Customers, Employees, ChoiceItem), and sample data for those tables.

    The whole point is that we need to be able to see what the data you're querying is like so we can see how to address your issue and test variations of your query to see what will provide the results you desire.

    Cheers!

    Why cant I just pass a backup of the DB itself?? Sure would make it easier on all of us.
    I really appreciate the responses...but if you need 5 tables and all the data, that's going to be some serious work, I guess I better get started.

  • Jacob Wilkins - Tuesday, June 6, 2017 2:08 PM

    Thanks for the effort, but that actually isn't quite what we need (right technique, but wrong content).

    We will need the structure of the underlying tables used by the query (Ticket, TicketItem, Customers, Employees, ChoiceItem), and sample data for those tables.

    The whole point is that we need to be able to see what the data you're querying is like so we can see how to address your issue and test variations of your query to see what will provide the results you desire.

    Cheers!

    https://www.dropbox.com/s/lt2mzedtxp361pi/slim3.zip?dl=0

    There is the link if anyone wants to grab it...SQL Sever 2014 file.

    None the less, ill get to work on all these tables and the data. Unfortunately, I cannot get Design view to work in 2014, used to open fine in 2008 R2...so ill have to type them all out by hand.

  • It doesn't have to be all that painful.

    For the table definitions, you can just right-click and script the definitions out from SSMS.

    For the data (can also be used for the definitions, but you have to be careful to make sure it matches your actual definition), you can use the technique described at https://spaghettidba.com/2015/04/24/how-to-post-a-t-sql-question-on-a-public-forum/

    That CSV to SQL Converter makes generating the INSERT statements relatively painless.

    Keep in mind that we don't need all the data. Just a handful of rows that illustrate the problem you're trying to solve.

    Cheers!

  • Jacob Wilkins - Tuesday, June 6, 2017 2:32 PM

    It doesn't have to be all that painful.

    For the table definitions, you can just right-click and script the definitions out from SSMS.

    For the data (can also be used for the definitions, but you have to be careful to make sure it matches your actual definition), you can use the technique described at https://spaghettidba.com/2015/04/24/how-to-post-a-t-sql-question-on-a-public-forum/

    That CSV to SQL Converter makes generating the INSERT statements relatively painless.

    Keep in mind that we don't need all the data. Just a handful of rows that illustrate the problem you're trying to solve.

    Cheers!

    Thank you so much!

    Chris

  • Will this work?? So if I do this for the 5 tables, this will get you what you need to assist?


    CREATE TABLE Ticket(
     i_ticket_id        DATE NOT NULL PRIMARY KEY
    ,i_customer_id       INTEGER NOT NULL
    ,s_table_name        VARCHAR2(20) NOT NULL
    ,c_items_total       NUMERIC(5,2) NOT NULL
    ,c_taxes_total       NUMERIC(4,2) NOT NULL
    ,c_discount_amount      NUMERIC(4,2) NOT NULL
    ,c_grand_total       NUMERIC(5,2) NOT NULL
    ,c_payment_total       NUMERIC(5,2) NOT NULL
    ,c_auto_gratuity       NUMERIC(4,2) NOT NULL
    ,f_auto_gratuity_pct     VARCHAR(4)
    ,i_void_ticket_id      VARCHAR(4)
    ,i_user_id         INTEGER NOT NULL
    ,dt_create_time       VARCHAR(23) NOT NULL
    ,dt_close_time       VARCHAR(23) NOT NULL
    ,b_closed         BIT NOT NULL
    ,dt_lock_time        VARCHAR(4)
    ,i_lock_user_id       VARCHAR(4)
    ,dt_cached_time       VARCHAR(23)
    ,i_created_by_user_id     INTEGER NOT NULL
    ,f_ticket_discount_factor    BIT NOT NULL
    ,i_ticket_revision      BIT NOT NULL
    ,i_ticket_actual_close_employee_id INTEGER NOT NULL
    ,c_ticket_tips       VARCHAR(4)
    ,i_ticket_seq_number     INTEGER NOT NULL
    ,c_ticket_display_subtotal   NUMERIC(5,2) NOT NULL
    ,c_ticket_display_tax_total   NUMERIC(4,2) NOT NULL
    ,i_ticket_timesheet_id     INTEGER NOT NULL
    ,dt_ticket_promise_time    VARCHAR(23) NOT NULL
    ,i_section_id        BIT NOT NULL
    ,i_address_id        INTEGER NOT NULL
    ,i_revcenter_id       INTEGER NOT NULL
    ,manual_hold        BIT NOT NULL
    ,choice_hold        BIT NOT NULL
    ,preauth_amount       NUMERIC(4,2) NOT NULL
    ,cover_count        BIT NOT NULL
    ,g_ticket_id        VARCHAR(36) NOT NULL
    ,rv_Ticket         INTEGER NOT NULL
    ,dt_recent_guest_check_print   VARCHAR(4)
    ,i_location_id       VARCHAR(4)
    ,s_cached_xml        VARCHAR(10018)
    ,b_use_custom_status     BIT NOT NULL
    ,s_custom_status       VARCHAR(30)
    ,s_status         VARCHAR(9) NOT NULL
    ,preauth_total_no_bar_tab    NUMERIC(4,2) NOT NULL
    ,i_active_seat_count     BIT NOT NULL
    ,dt_last_item_time      VARCHAR(23) NOT NULL
    ,dt_last_payment_time     VARCHAR(23) NOT NULL
    ,b_gratuity_removed      BIT NOT NULL
    );
    INSERT INTO Ticket(i_ticket_id,i_customer_id,s_table_name,c_items_total,c_taxes_total,c_discount_amount,c_grand_total,c_payment_total,c_auto_gratuity,f_auto_gratuity_pct,i_void_ticket_id,i_user_id,dt_create_time,dt_close_time,b_closed,dt_lock_time,i_lock_user_id,dt_cached_time,i_created_by_user_id,f_ticket_discount_factor,i_ticket_revision,i_ticket_actual_close_employee_id,c_ticket_tips,i_ticket_seq_number,c_ticket_display_subtotal,c_ticket_display_tax_total,i_ticket_timesheet_id,dt_ticket_promise_time,i_section_id,i_address_id,i_revcenter_id,manual_hold,choice_hold,preauth_amount,cover_count,g_ticket_id,rv_Ticket,dt_recent_guest_check_print,i_location_id,s_cached_xml,b_use_custom_status,s_custom_status,s_status,preauth_total_no_bar_tab,i_active_seat_count,dt_last_item_time,dt_last_payment_time,b_gratuity_removed) VALUES ('130250',481,'Cappuccilli, Allison',11.00,0.00,0.00,11.00,11.00,0.00,NULL,NULL,154,'2017-06-12 15:54:36.953','2017-06-12 15:54:49.270',1,NULL,NULL,NULL,154,0,0,154,NULL,161,11.00,0.00,16009,'1753-01-01 00:00:00.000',0,481,2,0,0,0.00,1,'2BD4CF2B-3078-46F6-AE0E-C162EB20821E',0x000000000105CD06,NULL,NULL,NULL,0,NULL,'FullyPaid',0.00,1,'2017-06-12 15:54:45.040','2017-06-12 15:54:48.643',0);
    INSERT INTO Ticket(i_ticket_id,i_customer_id,s_table_name,c_items_total,c_taxes_total,c_discount_amount,c_grand_total,c_payment_total,c_auto_gratuity,f_auto_gratuity_pct,i_void_ticket_id,i_user_id,dt_create_time,dt_close_time,b_closed,dt_lock_time,i_lock_user_id,dt_cached_time,i_created_by_user_id,f_ticket_discount_factor,i_ticket_revision,i_ticket_actual_close_employee_id,c_ticket_tips,i_ticket_seq_number,c_ticket_display_subtotal,c_ticket_display_tax_total,i_ticket_timesheet_id,dt_ticket_promise_time,i_section_id,i_address_id,i_revcenter_id,manual_hold,choice_hold,preauth_amount,cover_count,g_ticket_id,rv_Ticket,dt_recent_guest_check_print,i_location_id,s_cached_xml,b_use_custom_status,s_custom_status,s_status,preauth_total_no_bar_tab,i_active_seat_count,dt_last_item_time,dt_last_payment_time,b_gratuity_removed) VALUES ('130251',3886,'Chapski, Kathy',9.00,0.00,0.00,9.00,9.00,0.00,NULL,NULL,154,'2017-06-12 15:58:25.397','2017-06-12 15:58:35.257',1,NULL,NULL,NULL,154,0,0,154,NULL,162,9.00,0.00,16009,'1753-01-01 00:00:00.000',0,3887,2,0,0,0.00,1,'2E65A20C-A0FE-4491-9E4F-35729644FE79',0x000000000105CD07,NULL,NULL,NULL,0,NULL,'FullyPaid',0.00,1,'2017-06-12 15:58:28.643','2017-06-12 15:58:34.607',0);
    INSERT INTO Ticket(i_ticket_id,i_customer_id,s_table_name,c_items_total,c_taxes_total,c_discount_amount,c_grand_total,c_payment_total,c_auto_gratuity,f_auto_gratuity_pct,i_void_ticket_id,i_user_id,dt_create_time,dt_close_time,b_closed,dt_lock_time,i_lock_user_id,dt_cached_time,i_created_by_user_id,f_ticket_discount_factor,i_ticket_revision,i_ticket_actual_close_employee_id,c_ticket_tips,i_ticket_seq_number,c_ticket_display_subtotal,c_ticket_display_tax_total,i_ticket_timesheet_id,dt_ticket_promise_time,i_section_id,i_address_id,i_revcenter_id,manual_hold,choice_hold,preauth_amount,cover_count,g_ticket_id,rv_Ticket,dt_recent_guest_check_print,i_location_id,s_cached_xml,b_use_custom_status,s_custom_status,s_status,preauth_total_no_bar_tab,i_active_seat_count,dt_last_item_time,dt_last_payment_time,b_gratuity_removed) VALUES ('130252',3042,'Soares, Amber',5.00,0.00,0.00,5.00,5.00,0.00,NULL,NULL,154,'2017-06-12 15:58:46.727','2017-06-12 15:58:55.840',1,NULL,NULL,NULL,154,0,0,154,NULL,163,5.00,0.00,16009,'1753-01-01 00:00:00.000',0,3043,2,0,0,0.00,1,'05F4C67F-5F85-44BD-9498-BFCAD08635F3',0x000000000105CD08,NULL,NULL,NULL,0,NULL,'FullyPaid',0.00,1,'2017-06-12 15:58:51.333','2017-06-12 15:58:55.240',0);
    INSERT INTO Ticket(i_ticket_id,i_customer_id,s_table_name,c_items_total,c_taxes_total,c_discount_amount,c_grand_total,c_payment_total,c_auto_gratuity,f_auto_gratuity_pct,i_void_ticket_id,i_user_id,dt_create_time,dt_close_time,b_closed,dt_lock_time,i_lock_user_id,dt_cached_time,i_created_by_user_id,f_ticket_discount_factor,i_ticket_revision,i_ticket_actual_close_employee_id,c_ticket_tips,i_ticket_seq_number,c_ticket_display_subtotal,c_ticket_display_tax_total,i_ticket_timesheet_id,dt_ticket_promise_time,i_section_id,i_address_id,i_revcenter_id,manual_hold,choice_hold,preauth_amount,cover_count,g_ticket_id,rv_Ticket,dt_recent_guest_check_print,i_location_id,s_cached_xml,b_use_custom_status,s_custom_status,s_status,preauth_total_no_bar_tab,i_active_seat_count,dt_last_item_time,dt_last_payment_time,b_gratuity_removed) VALUES ('130253',3787,'Sorlien, Zoe',8.00,0.00,0.00,8.00,8.00,0.00,NULL,NULL,133,'2017-06-12 16:03:16.243','2017-06-12 16:03:25.133',1,NULL,NULL,NULL,133,0,0,133,NULL,164,8.00,0.00,16006,'1753-01-01 00:00:00.000',0,3788,2,0,0,0.00,1,'8EE7723D-916E-40D1-944F-E27D483A46D9',0x000000000105CFAE,NULL,NULL,NULL,0,NULL,'FullyPaid',0.00,1,'2017-06-12 16:03:20.300','2017-06-12 16:03:24.540',0);
    INSERT INTO Ticket(i_ticket_id,i_customer_id,s_table_name,c_items_total,c_taxes_total,c_discount_amount,c_grand_total,c_payment_total,c_auto_gratuity,f_auto_gratuity_pct,i_void_ticket_id,i_user_id,dt_create_time,dt_close_time,b_closed,dt_lock_time,i_lock_user_id,dt_cached_time,i_created_by_user_id,f_ticket_discount_factor,i_ticket_revision,i_ticket_actual_close_employee_id,c_ticket_tips,i_ticket_seq_number,c_ticket_display_subtotal,c_ticket_display_tax_total,i_ticket_timesheet_id,dt_ticket_promise_time,i_section_id,i_address_id,i_revcenter_id,manual_hold,choice_hold,preauth_amount,cover_count,g_ticket_id,rv_Ticket,dt_recent_guest_check_print,i_location_id,s_cached_xml,b_use_custom_status,s_custom_status,s_status,preauth_total_no_bar_tab,i_active_seat_count,dt_last_item_time,dt_last_payment_time,b_gratuity_removed) VALUES ('130254',3790,'Smith, Emma',9.00,0.00,0.00,9.00,9.00,0.00,NULL,NULL,176,'2017-06-12 16:13:01.620','2017-06-12 16:13:08.727',1,NULL,NULL,NULL,176,0,0,176,NULL,165,9.00,0.00,16010,'1753-01-01 00:00:00.000',0,3791,2,0,0,0.00,1,'E39824B6-925D-4980-B1BB-BBE4552C04F2',0x000000000105CE08,NULL,NULL,NULL,0,NULL,'FullyPaid',0.00,1,'2017-06-12 16:13:03.563','2017-06-12 16:13:07.920',0);
    INSERT INTO Ticket(i_ticket_id,i_customer_id,s_table_name,c_items_total,c_taxes_total,c_discount_amount,c_grand_total,c_payment_total,c_auto_gratuity,f_auto_gratuity_pct,i_void_ticket_id,i_user_id,dt_create_time,dt_close_time,b_closed,dt_lock_time,i_lock_user_id,dt_cached_time,i_created_by_user_id,f_ticket_discount_factor,i_ticket_revision,i_ticket_actual_close_employee_id,c_ticket_tips,i_ticket_seq_number,c_ticket_display_subtotal,c_ticket_display_tax_total,i_ticket_timesheet_id,dt_ticket_promise_time,i_section_id,i_address_id,i_revcenter_id,manual_hold,choice_hold,preauth_amount,cover_count,g_ticket_id,rv_Ticket,dt_recent_guest_check_print,i_location_id,s_cached_xml,b_use_custom_status,s_custom_status,s_status,preauth_total_no_bar_tab,i_active_seat_count,dt_last_item_time,dt_last_payment_time,b_gratuity_removed) VALUES ('130255',1369,'REED, BOB',20.00,0.00,0.00,20.00,20.00,0.00,NULL,NULL,176,'2017-06-12 16:15:45.210','2017-06-12 16:17:12.033',1,NULL,NULL,NULL,176,0,0,176,NULL,166,20.00,0.00,16010,'1753-01-01 00:00:00.000',0,1369,2,0,0,0.00,1,'07098FA2-77D1-4C48-AD51-7AEB33308D2B',0x000000000105CE09,NULL,NULL,NULL,0,NULL,'FullyPaid',0.00,1,'2017-06-12 16:16:52.343','2017-06-12 16:17:11.300',0);
    INSERT INTO Ticket(i_ticket_id,i_customer_id,s_table_name,c_items_total,c_taxes_total,c_discount_amount,c_grand_total,c_payment_total,c_auto_gratuity,f_auto_gratuity_pct,i_void_ticket_id,i_user_id,dt_create_time,dt_close_time,b_closed,dt_lock_time,i_lock_user_id,dt_cached_time,i_created_by_user_id,f_ticket_discount_factor,i_ticket_revision,i_ticket_actual_close_employee_id,c_ticket_tips,i_ticket_seq_number,c_ticket_display_subtotal,c_ticket_display_tax_total,i_ticket_timesheet_id,dt_ticket_promise_time,i_section_id,i_address_id,i_revcenter_id,manual_hold,choice_hold,preauth_amount,cover_count,g_ticket_id,rv_Ticket,dt_recent_guest_check_print,i_location_id,s_cached_xml,b_use_custom_status,s_custom_status,s_status,preauth_total_no_bar_tab,i_active_seat_count,dt_last_item_time,dt_last_payment_time,b_gratuity_removed) VALUES ('130256',3887,'Smith, Chris',9.00,0.00,0.00,9.00,9.00,0.00,NULL,NULL,1,'2017-06-13 09:00:21.150','2017-06-13 09:00:33.923',1,NULL,NULL,NULL,1,0,0,1,NULL,1,9.00,0.00,16014,'1753-01-01 00:00:00.000',0,3888,2,0,0,0.00,1,'5815A088-D1EC-4F39-9778-5305130235C0',0x000000000105D98E,NULL,NULL,NULL,0,NULL,'FullyPaid',0.00,1,'2017-06-13 09:00:24.520','2017-06-13 09:00:33.723',0);
    INSERT INTO Ticket(i_ticket_id,i_customer_id,s_table_name,c_items_total,c_taxes_total,c_discount_amount,c_grand_total,c_payment_total,c_auto_gratuity,f_auto_gratuity_pct,i_void_ticket_id,i_user_id,dt_create_time,dt_close_time,b_closed,dt_lock_time,i_lock_user_id,dt_cached_time,i_created_by_user_id,f_ticket_discount_factor,i_ticket_revision,i_ticket_actual_close_employee_id,c_ticket_tips,i_ticket_seq_number,c_ticket_display_subtotal,c_ticket_display_tax_total,i_ticket_timesheet_id,dt_ticket_promise_time,i_section_id,i_address_id,i_revcenter_id,manual_hold,choice_hold,preauth_amount,cover_count,g_ticket_id,rv_Ticket,dt_recent_guest_check_print,i_location_id,s_cached_xml,b_use_custom_status,s_custom_status,s_status,preauth_total_no_bar_tab,i_active_seat_count,dt_last_item_time,dt_last_payment_time,b_gratuity_removed) VALUES ('130257',0,'InPayments #2',9.00,0.00,0.00,9.00,9.00,0.00,NULL,NULL,1,'2017-06-13 09:00:52.883','2017-06-13 09:00:54.213',1,NULL,NULL,'2017-06-13 09:43:16.370',1,0,0,1,NULL,2,9.00,0.00,16014,'1753-01-01 00:00:00.000',0,0,2,0,0,0.00,1,'F9212DE4-1FB9-41A2-9D7C-B3C11BE1D2A4',0x000000000105DBB2,NULL,NULL,'<Ticket xmlns="http://schemas.datacontract.org/2004/07/Dinerware" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><InstanceGuid>f9212de4-1fb9-41a2-9d7c-b3c11be1d2a4</InstanceGuid><ActiveSeatcount>1</ActiveSeatcount><AutoGratApplicableAmount>9.00</AutoGratApplicableAmount><CloseTime>2017-06-13T09:00:54.213-07:00</CloseTime><CoverCount>1</CoverCount><CreateTime>2017-06-13T09:00:52.883-07:00</CreateTime><CustomStatus/><Discounts/><FastPayCashDrawer/><FirstItemTime>2017-06-13T09:00:52.89-07:00</FirstItemTime><Gratuity><Amount>0</Amount><ManualAmount>false</ManualAmount><Percent>0</Percent><Removed>false</Removed></Gratuity><ID>130257</ID><LastGuestCheckPrint>0001-01-01T00:00:00</LastGuestCheckPrint><LastItemTime>2017-06-13T09:00:48.763-07:00</LastItemTime><LastPaymentTime>2017-06-13T09:00:54.08-07:00</LastPaymentTime><LocationID>0</LocationID><Memberships/><OwnerID>1</OwnerID><PaymentTotal>9.0000</PaymentTotal><Payments/><PotentialSurcharges/><PromiseTime>1753-01-01T00:00:00</PromiseTime><RealSubtotal>9.0000</RealSubtotal><RevCenterId>2</RevCenterId><RevCenterName>Nutrition Club</RevCenterName><Seats><Cover><Id>74647</Id><Index>1</Index><Selected>false</Selected><TicketItems><MenuItem><InstanceGuid>62f4d307-f115-4504-8e9c-6e06e345827f</InstanceGuid><Active>false</Active><AlwaysShowSpecialRequest>false</AlwaysShowSpecialRequest><ApplicableTicketDiscountsString/><ApplicableTicketTaxesString/><ChoiceCats><ChoiceCategory><Active>false</Active><AlternateKprintName/><BartenderExemption>false</BartenderExemption><CatQuantityBehavior>SameAsParent</CatQuantityBehavior><CategoryName>TEA FLAVOR:</CategoryName><Choices><Choice><Active>true</Active><ChoiceAlternateKprintName/><ChoiceCategories/><ChoiceName>Cinnamon Tea Cold</ChoiceName><Cost>0</Cost><CourseID>0</CourseID><ID>133</ID><OriginalQuantity>1.0000</OriginalQuantity><OriginalShareQuantity>1</OriginalShareQuantity><OverrideCategoryPrice>false</OverrideCategoryPrice><PriceModifier>0</PriceModifier><PriceModifierPct>0</PriceModifierPct><PrintRed>false</PrintRed><Quantity>1.0000</Quantity><SKU i:nil="true"/><TicketChoiceID>162941</TicketChoiceID><TimeAdded>2017-06-13T09:00:50.863-07:00</TimeAdded><UsesPercent>false</UsesPercent></Choice></Choices><ID>25</ID><InheritPricing>false</InheritPricing><InstanceID>369317</InstanceID><IsOptional>false</IsOptional><MaxChoiceQty>1</MaxChoiceQty><MinChoiceQty>1</MinChoiceQty><MultiSelect>false</MultiSelect><ParentChoiceInstanceID/><PrependName>false</PrependName><PriceModifier>0</PriceModifier><PriceModifierPct>0</PriceModifierPct><PrintRed>false</PrintRed><Timid>false</Timid><UsesPercent>false</UsesPercent></ChoiceCategory><ChoiceCategory><Active>false</Active><AlternateKprintName/><BartenderExemption>false</BartenderExemption><CatQuantityBehavior>SameAsParent</CatQuantityBehavior><CategoryName>ALOE SHOT:</CategoryName><Choices><Choice><Active>true</Active><ChoiceAlternateKprintName/><ChoiceCategories/><ChoiceName>Cranberry Aloe Shot</ChoiceName><Cost>0</Cost><CourseID>0</CourseID><ID>119</ID><OriginalQuantity>1.0000</OriginalQuantity><OriginalShareQuantity>1</OriginalShareQuantity><OverrideCategoryPrice>false</OverrideCategoryPrice><PriceModifier>0</PriceModifier><PriceModifierPct>0</PriceModifierPct><PrintRed>false</PrintRed><Quantity>1.0000</Quantity><SKU i:nil="true"/><TicketChoiceID>162942</TicketChoiceID><TimeAdded>2017-06-13T09:00:51.6-07:00</TimeAdded><UsesPercent>false</UsesPercent></Choice></Choices><ID>26</ID><InheritPricing>false</InheritPricing><InstanceID>369318</InstanceID><IsOptional>false</IsOptional><MaxChoiceQty>1</MaxChoiceQty><MinChoiceQty>1</MinChoiceQty><MultiSelect>false</MultiSelect><ParentChoiceInstanceID/><PrependName>false</PrependName><PriceModifier>0</PriceModifier><PriceModifierPct>0</PriceModifierPct><PrintRed>false</PrintRed><Timid>false</Timid><UsesPercent>false</UsesPercent></ChoiceCategory><ChoiceCategory><Active>true</Active><AlternateKprintName/><BartenderExemption>false</BartenderExemption><CatQuantityBehavior>SameAsParent</CatQuantityBehavior><CategoryName>PROTEIN SUBSTITUTION:</CategoryName><Choices/><DefaultChoiceID>0</DefaultChoiceID><ID>27</ID><InheritPricing>true</InheritPricing><InstanceID/><IsOptional>true</IsOptional><MaxChoiceQty>1</MaxChoiceQty><MinChoiceQty>1</MinChoiceQty><MultiSelect>false</MultiSelect><Ordinal>9</Ordinal><ParentChoiceInstanceID/><PrependName>true</PrependName><PriceModifier>0</PriceModifier><PriceModifierPct>0</PriceModifierPct><PrintRed>false</PrintRed><Timid>true</Timid><UsesPercent>false</UsesPercent></ChoiceCategory><ChoiceCategory><Active>true</Active><AlternateKprintName/><BartenderExemption>false</BartenderExemption><CatQuantityBehavior>SameAsParent</CatQuantityBehavior><CategoryName>UPGRADES:</CategoryName><Choices/><DefaultChoiceID>0</DefaultChoiceID><ID>21</ID><InheritPricing>false</InheritPricing><InstanceID/><IsOptional>true</IsOptional><MaxChoiceQty>1</MaxChoiceQty><MinChoiceQty>1</MinChoiceQty><MultiSelect>false</MultiSelect><Ordinal>10</Ordinal><ParentChoiceInstanceID/><PrependName>true</PrependName><PriceModifier>0</PriceModifier><PriceModifierPct>0</PriceModifierPct><PrintRed>false</PrintRed><Timid>false</Timid><UsesPercent>false</UsesPercent></ChoiceCategory><ChoiceCategory><Active>true</Active><AlternateKprintName/><BartenderExemption>false</BartenderExemption><CatQuantityBehavior>SameAsParent</CatQuantityBehavior><CategoryName>ADD:</CategoryName><Choices/><DefaultChoiceID>0</DefaultChoiceID><ID>24</ID><InheritPricing>false</InheritPricing><InstanceID/><IsOptional>true</IsOptional><MaxChoiceQty>1</MaxChoiceQty><MinChoiceQty>1</MinChoiceQty><MultiSelect>true</MultiSelect><Ordinal>11</Ordinal><ParentChoiceInstanceID/><PrependName>true</PrependName><PriceModifier>0</PriceModifier><PriceModifierPct>0</PriceModifierPct><PrintRed>false</PrintRed><Timid>false</Timid><UsesPercent>false</UsesPercent></ChoiceCategory></ChoiceCats><Choices><Choice><Active>true</Active><ChoiceAlternateKprintName/><ChoiceCategories/><ChoiceName>Cinnamon Tea Cold</ChoiceName><Cost>0</Cost><CourseID>0</CourseID><ID>133</ID><OriginalQuantity>1.0000</OriginalQuantity><OriginalShareQuantity>1</OriginalShareQuantity><OverrideCategoryPrice>false</OverrideCategoryPrice><PriceModifier>0</PriceModifier><PriceModifierPct>0</PriceModifierPct><PrintRed>false</PrintRed><Quantity>1.0000</Quantity><SKU i:nil="true"/><TicketChoiceID>162941</TicketChoiceID><TimeAdded>2017-06-13T09:00:50.863-07:00</TimeAdded><UsesPercent>false</UsesPercent></Choice><Choice><Active>true</Active><ChoiceAlternateKprintName/><ChoiceCategories/><ChoiceName>Cranberry Aloe Shot</ChoiceName><Cost>0</Cost><CourseID>0</CourseID><ID>119</ID><OriginalQuantity>1.0000</OriginalQuantity><OriginalShareQuantity>1</OriginalShareQuantity><OverrideCategoryPrice>false</OverrideCategoryPrice><PriceModifier>0</PriceModifier><PriceModifierPct>0</PriceModifierPct><PrintRed>false</PrintRed><Quantity>1.0000</Quantity><SKU i:nil="true"/><TicketChoiceID>162942</TicketChoiceID><TimeAdded>2017-06-13T09:00:51.6-07:00</TimeAdded><UsesPercent>false</UsesPercent></Choice></Choices><CommitTime>2017-06-13T09:00:52.89-07:00</CommitTime><Cost>0</Cost><DecimalSplit>1</DecimalSplit><DefaultQuantity>1</DefaultQuantity><Description/><Discounts/><DisplayPrice>9.0000</DisplayPrice><ExpandedPrice>9.0000</ExpandedPrice><FractionSplit>1</FractionSplit><ID>505</ID><ItemName>Samoas</ItemName><MenuDescription/><NoPrint>false</NoPrint><OpenItem>false</OpenItem><OriginalAddTime>2017-06-13T09:00:48.763-07:00</OriginalAddTime><Price>9.0000</Price><PriceCatID>46</PriceCatID><PriceLevelChoiceCategory>-1</PriceLevelChoiceCategory><PriceXQuantity>9.0000</PriceXQuantity><Quantity>1</Quantity><RealQty>1</RealQty><RevenueCenterID>2</RevenueCenterID><RevenueCenterName>Nutrition Club</RevenueCenterName><RevenueClassID>12</RevenueClassID><RevenueClassName>Shakes</RevenueClassName><SKU/><SoldByWeight>false</SoldByWeight><SpecialGrossWithOnlyHiddenTaxRemoved>9.0000</SpecialGrossWithOnlyHiddenTaxRemoved><SpecialRequest/><SplitGroup>1</SplitGroup><TIID>579175</TIID><TareWeight>0</TareWeight><Taxes/><UsesFixedPrice>false</UsesFixedPrice></MenuItem></TicketItems></Cover></Seats><SequenceNum>2</SequenceNum><Status>FullyPaid</Status><Subtotal>9.0000</Subtotal><TableName>InPayments #2</TableName><Taxes><Tax><Active>true</Active><AddInData/><AppliesAll>false</AppliesAll><AppliesGratuity>true</AppliesGratuity><ExtraHeaderLineText/><ExtraHeaderLineTwo/><ExtraHeaderOnGuestChecks>false</ExtraHeaderOnGuestChecks><ExtraHeaderOnReceipts>false</ExtraHeaderOnReceipts><FlatFeeAmount>0</FlatFeeAmount><GratuityAppliesAfterVAT>false</GratuityAppliesAfterVAT><HiddenTaxOrder>-1</HiddenTaxOrder><HideWhenAllLiquor>false</HideWhenAllLiquor><ID>16</ID><Inclusive>false</Inclusive><IsFloridaTax>false</IsFloridaTax><IsProRatedInstance>false</IsProRatedInstance><IsVAT>false</IsVAT><Level>1</Level><MarkCharacter/><MarkItems>false</MarkItems><MarkLegend/><MenuItemIDs xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays"/><NonLiquor>false</NonLiquor><PerPersonThreshold>false</PerPersonThreshold><PerPersonThresholdAmount>0</PerPersonThresholdAmount><Percent>0.07</Percent><RCThreshold>false</RCThreshold><RCThresholdAmount>0</RCThresholdAmount><RateName>7% Tax (Catalog)</RateName><Reason/><RemovedAmount>0</RemovedAmount><RevClassIDs xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays"><a:int>11</a:int></RevClassIDs><RevenueCenterIds xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays"/><RoundingType>normal</RoundingType><SectionIds xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays"/><ShowActualPrice>false</ShowActualPrice><ShowExtraHeaderLine>false</ShowExtraHeaderLine><ShowSubtotalLine>true</ShowSubtotalLine><SubtotalLineText>Tax + S&amp;H</SubtotalLineText><TotalAmount>0</TotalAmount><UsesFlatFee>false</UsesFlatFee><isTicketLevel>false</isTicketLevel></Tax></Taxes><Total>9.0000</Total><UseCustomStatus>false</UseCustomStatus><UserID>1</UserID><UserName/></Ticket>',0,NULL,'FullyPaid',0.00,1,'2017-06-13 09:00:48.763','2017-06-13 09:00:54.080',0);
    INSERT INTO Ticket(i_ticket_id,i_customer_id,s_table_name,c_items_total,c_taxes_total,c_discount_amount,c_grand_total,c_payment_total,c_auto_gratuity,f_auto_gratuity_pct,i_void_ticket_id,i_user_id,dt_create_time,dt_close_time,b_closed,dt_lock_time,i_lock_user_id,dt_cached_time,i_created_by_user_id,f_ticket_discount_factor,i_ticket_revision,i_ticket_actual_close_employee_id,c_ticket_tips,i_ticket_seq_number,c_ticket_display_subtotal,c_ticket_display_tax_total,i_ticket_timesheet_id,dt_ticket_promise_time,i_section_id,i_address_id,i_revcenter_id,manual_hold,choice_hold,preauth_amount,cover_count,g_ticket_id,rv_Ticket,dt_recent_guest_check_print,i_location_id,s_cached_xml,b_use_custom_status,s_custom_status,s_status,preauth_total_no_bar_tab,i_active_seat_count,dt_last_item_time,dt_last_payment_time,b_gratuity_removed) VALUES ('130258',3887,'InPayments #3',4.00,0.00,0.00,4.00,4.00,0.00,NULL,NULL,1,'2017-06-13 09:37:39.773','2017-06-13 09:37:41.190',1,NULL,NULL,'2017-06-13 09:43:18.107',1,0,0,1,NULL,3,4.00,0.00,16014,'1753-01-01 00:00:00.000',0,3888,2,0,0,0.00,1,'707A5E08-715E-4DA8-9D3B-24FBEC6B0842',0x000000000105DBCD,NULL,NULL,'<Ticket xmlns="http://schemas.datacontract.org/2004/07/Dinerware" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><InstanceGuid>707a5e08-715e-4da8-9d3b-24fbec6b0842</InstanceGuid><ActiveSeatcount>1</ActiveSeatcount><AddressID>3888</AddressID><AutoGratApplicableAmount>4.00</AutoGratApplicableAmount><CloseTime>2017-06-13T09:37:41.19-07:00</CloseTime><CoverCount>1</CoverCount><CreateTime>2017-06-13T09:37:39.773-07:00</CreateTime><CustomStatus/><Customer><InstanceGuid>d71f6c6e-da19-40e2-b731-adf3b3066e69</InstanceGuid><Active>true</Active><Anniversary>1900-01-01T00:00:00-08:00</Anniversary><Birthday>1900-01-01T00:00:00-08:00</Birthday><CallerID/><CurrentId>3887</CurrentId><DateAdded>2017-06-13T09:00:16.32-07:00</DateAdded><DateEdited>2017-06-13T09:00:16.32-07:00</DateEdited><EditedByUserId>1</EditedByUserId><EditedByUserName>InPayments</EditedByUserName><Email/><Email2/><FName>Chris</FName><ID>3887</ID><IsAnonymous>false</IsAnonymous><IsChanged>true</IsChanged><IsDeleted>false</IsDeleted><IsNew>false</IsNew><LName>Smith</LName><MembershipCardInfo/><MembershipID>156156</MembershipID><Notes/><OriginalId>3887</OriginalId><Phone>7075673304</Phone><theAddresses><Address><Address1>1060 Elfstone Ct</Address1><Address2/><AddressType/><City>Westlake Village</City><CurrentId>3888</CurrentId><ID>3888</ID><IsActive>true</IsActive><IsChanged>true</IsChanged><IsDeleted>false</IsDeleted><IsNew>false</IsNew><Name/><Note/><OriginalId>3888</OriginalId><PersonID>3887</PersonID><Phone/><PostalCode>91361</PostalCode><State>CA</State><SupercededById>-1</SupercededById></Address></theAddresses></Customer><Discounts/><FastPayCashDrawer/><FirstItemTime>2017-06-13T09:37:39.78-07:00</FirstItemTime><Gratuity><Amount>0</Amount><ManualAmount>false</ManualAmount><Percent>0</Percent><Removed>false</Removed></Gratuity><ID>130258</ID><LastGuestCheckPrint>0001-01-01T00:00:00</LastGuestCheckPrint><LastItemTime>2017-06-13T09:37:18.153-07:00</LastItemTime><LastPaymentTime>2017-06-13T09:37:41.06-07:00</LastPaymentTime><LocationID>0</LocationID><Memberships/><OwnerID>1</OwnerID><PaymentTotal>4.0000</PaymentTotal><Payments/><PotentialSurcharges/><PromiseTime>1753-01-01T00:00:00</PromiseTime><RealSubtotal>4.0000</RealSubtotal><RevCenterId>2</RevCenterId><RevCenterName>Nutrition Club</RevCenterName><Seats><Cover><Id>74648</Id><Index>1</Index><Selected>false</Selected><TicketItems><MenuItem><InstanceGuid>f0caaca7-d47f-4536-9f4c-6a4fd53f8696</InstanceGuid><Active>false</Active><AlwaysShowSpecialRequest>false</AlwaysShowSpecialRequest><ApplicableTicketDiscountsString/><ApplicableTicketTaxesString/><ChoiceCats/><Choices/><CommitTime>2017-06-13T09:37:39.78-07:00</CommitTime><Cost>0</Cost><DecimalSplit>1</DecimalSplit><DefaultQuantity>1</DefaultQuantity><Description/><Discounts/><DisplayPrice>2.0000</DisplayPrice><ExpandedPrice>2.0000</ExpandedPrice><FractionSplit>1</FractionSplit><ID>541</ID><ItemName>Orange H3O</ItemName><MenuDescription/><NoPrint>false</NoPrint><OpenItem>false</OpenItem><OriginalAddTime>2017-06-13T09:37:17.58-07:00</OriginalAddTime><Price>2.0000</Price><PriceCatID>-1</PriceCatID><PriceLevelChoiceCategory>-1</PriceLevelChoiceCategory><PriceXQuantity>2.0000</PriceXQuantity><Quantity>1</Quantity><RealQty>1</RealQty><RevenueCenterID>2</RevenueCenterID><RevenueCenterName>Nutrition Club</RevenueCenterName><RevenueClassID>18</RevenueClassID><RevenueClassName>Functional</RevenueClassName><SKU/><SoldByWeight>false</SoldByWeight><SpecialGrossWithOnlyHiddenTaxRemoved>2.0000</SpecialGrossWithOnlyHiddenTaxRemoved><SpecialRequest/><SplitGroup>1</SplitGroup><TIID>579176</TIID><TareWeight>0</TareWeight><Taxes/><UsesFixedPrice>false</UsesFixedPrice></MenuItem><MenuItem><InstanceGuid>db44e614-1487-4e2c-8787-e9aeafe9cd1f</InstanceGuid><Active>false</Active><AlwaysShowSpecialRequest>false</AlwaysShowSpecialRequest><ApplicableTicketDiscountsString/><ApplicableTicketTaxesString/><ChoiceCats/><Choices/><CommitTime>2017-06-13T09:37:39.787-07:00</CommitTime><Cost>0</Cost><DecimalSplit>1</DecimalSplit><DefaultQuantity>1</DefaultQuantity><Description/><Discounts/><DisplayPrice>2.0000</DisplayPrice><ExpandedPrice>2.0000</ExpandedPrice><FractionSplit>1</FractionSplit><ID>541</ID><ItemName>Orange H3O</ItemName><MenuDescription/><NoPrint>false</NoPrint><OpenItem>false</OpenItem><OriginalAddTime>2017-06-13T09:37:18.153-07:00</OriginalAddTime><Price>2.0000</Price><PriceCatID>-1</PriceCatID><PriceLevelChoiceCategory>-1</PriceLevelChoiceCategory><PriceXQuantity>2.0000</PriceXQuantity><Quantity>1</Quantity><RealQty>1</RealQty><RevenueCenterID>2</RevenueCenterID><RevenueCenterName>Nutrition Club</RevenueCenterName><RevenueClassID>18</RevenueClassID><RevenueClassName>Functional</RevenueClassName><SKU/><SoldByWeight>false</SoldByWeight><SpecialGrossWithOnlyHiddenTaxRemoved>2.0000</SpecialGrossWithOnlyHiddenTaxRemoved><SpecialRequest/><SplitGroup>2</SplitGroup><TIID>579177</TIID><TareWeight>0</TareWeight><Taxes/><UsesFixedPrice>false</UsesFixedPrice></MenuItem></TicketItems></Cover></Seats><SequenceNum>3</SequenceNum><Status>FullyPaid</Status><Subtotal>4.0000</Subtotal><TableName>InPayments #3</TableName><Taxes><Tax><Active>true</Active><AddInData/><AppliesAll>false</AppliesAll><AppliesGratuity>true</AppliesGratuity><ExtraHeaderLineText/><ExtraHeaderLineTwo/><ExtraHeaderOnGuestChecks>false</ExtraHeaderOnGuestChecks><ExtraHeaderOnReceipts>false</ExtraHeaderOnReceipts><FlatFeeAmount>0</FlatFeeAmount><GratuityAppliesAfterVAT>false</GratuityAppliesAfterVAT><HiddenTaxOrder>-1</HiddenTaxOrder><HideWhenAllLiquor>false</HideWhenAllLiquor><ID>16</ID><Inclusive>false</Inclusive><IsFloridaTax>false</IsFloridaTax><IsProRatedInstance>false</IsProRatedInstance><IsVAT>false</IsVAT><Level>1</Level><MarkCharacter/><MarkItems>false</MarkItems><MarkLegend/><MenuItemIDs xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays"/><NonLiquor>false</NonLiquor><PerPersonThreshold>false</PerPersonThreshold><PerPersonThresholdAmount>0</PerPersonThresholdAmount><Percent>0.07</Percent><RCThreshold>false</RCThreshold><RCThresholdAmount>0</RCThresholdAmount><RateName>7% Tax (Catalog)</RateName><Reason/><RemovedAmount>0</RemovedAmount><RevClassIDs xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays"><a:int>11</a:int></RevClassIDs><RevenueCenterIds xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays"/><RoundingType>normal</RoundingType><SectionIds xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays"/><ShowActualPrice>false</ShowActualPrice><ShowExtraHeaderLine>false</ShowExtraHeaderLine><ShowSubtotalLine>true</ShowSubtotalLine><SubtotalLineText>Tax + S&amp;H</SubtotalLineText><TotalAmount>0</TotalAmount><UsesFlatFee>false</UsesFlatFee><isTicketLevel>false</isTicketLevel></Tax></Taxes><Total>4.0000</Total><UseCustomStatus>false</UseCustomStatus><UserID>1</UserID><UserName/></Ticket>',0,NULL,'FullyPaid',0.00,1,'2017-06-13 09:37:18.153','2017-06-13 09:37:41.060',0);
    INSERT INTO Ticket(i_ticket_id,i_customer_id,s_table_name,c_items_total,c_taxes_total,c_discount_amount,c_grand_total,c_payment_total,c_auto_gratuity,f_auto_gratuity_pct,i_void_ticket_id,i_user_id,dt_create_time,dt_close_time,b_closed,dt_lock_time,i_lock_user_id,dt_cached_time,i_created_by_user_id,f_ticket_discount_factor,i_ticket_revision,i_ticket_actual_close_employee_id,c_ticket_tips,i_ticket_seq_number,c_ticket_display_subtotal,c_ticket_display_tax_total,i_ticket_timesheet_id,dt_ticket_promise_time,i_section_id,i_address_id,i_revcenter_id,manual_hold,choice_hold,preauth_amount,cover_count,g_ticket_id,rv_Ticket,dt_recent_guest_check_print,i_location_id,s_cached_xml,b_use_custom_status,s_custom_status,s_status,preauth_total_no_bar_tab,i_active_seat_count,dt_last_item_time,dt_last_payment_time,b_gratuity_removed) VALUES ('130259',3887,'InPayments #4',2.00,0.00,0.00,2.00,2.00,0.00,NULL,NULL,1,'2017-06-13 09:43:55.637','2017-06-13 09:43:57.067',1,NULL,NULL,NULL,1,0,0,1,NULL,5,2.00,0.00,16014,'1753-01-01 00:00:00.000',0,3888,2,0,0,0.00,1,'72A093C5-2BB8-4122-AD23-4859DCF3A13F',0x000000000105DC64,NULL,NULL,NULL,0,NULL,'FullyPaid',0.00,1,'2017-06-13 09:43:41.653','2017-06-13 09:43:56.980',0);

  • Anyone? Please I have a deadline in 36hrs 🙁

  • Yes please, and expected results based on the sample data that you post.  Seriously, though, if it's that urgent, you ought to pay for someone to come in and help you.

    John

  • John Mitchell-245523 - Wednesday, June 14, 2017 2:22 AM

    Yes please, and expected results based on the sample data that you post.  Seriously, though, if it's that urgent, you ought to pay for someone to come in and help you.

    John

    Thanks John, ill post the tables up today. This is helping me learn, greatly.

  • Here are the 5 Tables with some sample data, taken directly from the database.

    This Query, works, but it shoes redundant data I need omitted. IF there is a line 2, I need to only display the ChoiceItem.

    Also, if there is no ChoiceItem attached to a s_item (a menu item) then I still want that Item to display, currently, only items with ChoiceItem attached are displaying. in this Query.

    Thank you!

    CREATE TABLE Ticket(
     i_ticket_id        DATE NOT NULL PRIMARY KEY
    ,i_customer_id       INTEGER NOT NULL
    ,s_table_name        VARCHAR2(20) NOT NULL
    ,c_items_total       NUMERIC(5,2) NOT NULL
    ,c_taxes_total       NUMERIC(4,2) NOT NULL
    ,c_discount_amount      NUMERIC(4,2) NOT NULL
    ,c_grand_total       NUMERIC(5,2) NOT NULL
    ,c_payment_total       NUMERIC(5,2) NOT NULL
    ,c_auto_gratuity       NUMERIC(4,2) NOT NULL
    ,f_auto_gratuity_pct     VARCHAR(4)
    ,i_void_ticket_id      VARCHAR(4)
    ,i_user_id         INTEGER NOT NULL
    ,dt_create_time       VARCHAR(23) NOT NULL
    ,dt_close_time       VARCHAR(23) NOT NULL
    ,b_closed         BIT NOT NULL
    ,dt_lock_time        VARCHAR(4)
    ,i_lock_user_id       VARCHAR(4)
    ,dt_cached_time       VARCHAR(23)
    ,i_created_by_user_id     INTEGER NOT NULL
    ,f_ticket_discount_factor    BIT NOT NULL
    ,i_ticket_revision      BIT NOT NULL
    ,i_ticket_actual_close_employee_id INTEGER NOT NULL
    ,c_ticket_tips       VARCHAR(4)
    ,i_ticket_seq_number     INTEGER NOT NULL
    ,c_ticket_display_subtotal   NUMERIC(5,2) NOT NULL
    ,c_ticket_display_tax_total   NUMERIC(4,2) NOT NULL
    ,i_ticket_timesheet_id     INTEGER NOT NULL
    ,dt_ticket_promise_time    VARCHAR(23) NOT NULL
    ,i_section_id        BIT NOT NULL
    ,i_address_id        INTEGER NOT NULL
    ,i_revcenter_id       INTEGER NOT NULL
    ,manual_hold        BIT NOT NULL
    ,choice_hold        BIT NOT NULL
    ,preauth_amount       NUMERIC(4,2) NOT NULL
    ,cover_count        BIT NOT NULL
    ,g_ticket_id        VARCHAR(36) NOT NULL
    ,rv_Ticket         INTEGER NOT NULL
    ,dt_recent_guest_check_print   VARCHAR(4)
    ,i_location_id       VARCHAR(4)
    ,s_cached_xml        VARCHAR(10018)
    ,b_use_custom_status     BIT NOT NULL
    ,s_custom_status       VARCHAR(30)
    ,s_status         VARCHAR(9) NOT NULL
    ,preauth_total_no_bar_tab    NUMERIC(4,2) NOT NULL
    ,i_active_seat_count     BIT NOT NULL
    ,dt_last_item_time      VARCHAR(23) NOT NULL
    ,dt_last_payment_time     VARCHAR(23) NOT NULL
    ,b_gratuity_removed      BIT NOT NULL
    );
    INSERT INTO mytable(i_ticket_id,i_customer_id,s_table_name,c_items_total,c_taxes_total,c_discount_amount,c_grand_total,c_payment_total,c_auto_gratuity,f_auto_gratuity_pct,i_void_ticket_id,i_user_id,dt_create_time,dt_close_time,b_closed,dt_lock_time,i_lock_user_id,dt_cached_time,i_created_by_user_id,f_ticket_discount_factor,i_ticket_revision,i_ticket_actual_close_employee_id,c_ticket_tips,i_ticket_seq_number,c_ticket_display_subtotal,c_ticket_display_tax_total,i_ticket_timesheet_id,dt_ticket_promise_time,i_section_id,i_address_id,i_revcenter_id,manual_hold,choice_hold,preauth_amount,cover_count,g_ticket_id,rv_Ticket,dt_recent_guest_check_print,i_location_id,s_cached_xml,b_use_custom_status,s_custom_status,s_status,preauth_total_no_bar_tab,i_active_seat_count,dt_last_item_time,dt_last_payment_time,b_gratuity_removed) VALUES ('130246',3029,'Mohr, Chelsey',9.00,0.00,0.00,9.00,9.00,0.00,NULL,NULL,154,'2017-06-12 15:14:25.710','2017-06-12 15:16:31.507',1,NULL,NULL,NULL,154,0,0,154,NULL,157,9.00,0.00,16009,'1753-01-01 00:00:00.000',0,3030,2,0,0,0.00,1,'AA9ABCE3-8A91-4AF9-9FD0-6873F2A161A1',0x000000000105CD05,NULL,NULL,NULL,0,NULL,'FullyPaid',0.00,1,'2017-06-12 15:14:32.770','2017-06-12 15:16:30.103',0);
    INSERT INTO mytable(i_ticket_id,i_customer_id,s_table_name,c_items_total,c_taxes_total,c_discount_amount,c_grand_total,c_payment_total,c_auto_gratuity,f_auto_gratuity_pct,i_void_ticket_id,i_user_id,dt_create_time,dt_close_time,b_closed,dt_lock_time,i_lock_user_id,dt_cached_time,i_created_by_user_id,f_ticket_discount_factor,i_ticket_revision,i_ticket_actual_close_employee_id,c_ticket_tips,i_ticket_seq_number,c_ticket_display_subtotal,c_ticket_display_tax_total,i_ticket_timesheet_id,dt_ticket_promise_time,i_section_id,i_address_id,i_revcenter_id,manual_hold,choice_hold,preauth_amount,cover_count,g_ticket_id,rv_Ticket,dt_recent_guest_check_print,i_location_id,s_cached_xml,b_use_custom_status,s_custom_status,s_status,preauth_total_no_bar_tab,i_active_seat_count,dt_last_item_time,dt_last_payment_time,b_gratuity_removed) VALUES ('130247',3324,'Barker, April',11.00,0.00,0.00,11.00,11.00,0.00,NULL,NULL,133,'2017-06-12 15:15:03.480','2017-06-12 15:16:02.537',1,NULL,NULL,NULL,133,0,0,133,NULL,158,11.00,0.00,16006,'1753-01-01 00:00:00.000',0,3325,2,0,0,0.00,1,'A70695AF-16A3-4BE0-B076-7DF0B042C6F5',0x000000000105CFAC,NULL,NULL,NULL,0,NULL,'FullyPaid',0.00,1,'2017-06-12 15:15:15.550','2017-06-12 15:16:01.100',0);
    INSERT INTO mytable(i_ticket_id,i_customer_id,s_table_name,c_items_total,c_taxes_total,c_discount_amount,c_grand_total,c_payment_total,c_auto_gratuity,f_auto_gratuity_pct,i_void_ticket_id,i_user_id,dt_create_time,dt_close_time,b_closed,dt_lock_time,i_lock_user_id,dt_cached_time,i_created_by_user_id,f_ticket_discount_factor,i_ticket_revision,i_ticket_actual_close_employee_id,c_ticket_tips,i_ticket_seq_number,c_ticket_display_subtotal,c_ticket_display_tax_total,i_ticket_timesheet_id,dt_ticket_promise_time,i_section_id,i_address_id,i_revcenter_id,manual_hold,choice_hold,preauth_amount,cover_count,g_ticket_id,rv_Ticket,dt_recent_guest_check_print,i_location_id,s_cached_xml,b_use_custom_status,s_custom_status,s_status,preauth_total_no_bar_tab,i_active_seat_count,dt_last_item_time,dt_last_payment_time,b_gratuity_removed) VALUES ('130248',2893,'Chella, Hope',11.00,0.00,0.00,11.00,11.00,0.00,NULL,NULL,176,'2017-06-12 15:21:38.417','2017-06-12 15:22:59.747',1,NULL,NULL,NULL,176,0,0,176,NULL,159,11.00,0.00,16010,'1753-01-01 00:00:00.000',0,2893,2,0,0,0.00,1,'08907A96-0B16-4CD2-80FE-3D58EB2DC9B6',0x000000000105CE07,NULL,NULL,NULL,0,NULL,'FullyPaid',0.00,1,'2017-06-12 15:22:02.627','2017-06-12 15:22:58.167',0);
    INSERT INTO mytable(i_ticket_id,i_customer_id,s_table_name,c_items_total,c_taxes_total,c_discount_amount,c_grand_total,c_payment_total,c_auto_gratuity,f_auto_gratuity_pct,i_void_ticket_id,i_user_id,dt_create_time,dt_close_time,b_closed,dt_lock_time,i_lock_user_id,dt_cached_time,i_created_by_user_id,f_ticket_discount_factor,i_ticket_revision,i_ticket_actual_close_employee_id,c_ticket_tips,i_ticket_seq_number,c_ticket_display_subtotal,c_ticket_display_tax_total,i_ticket_timesheet_id,dt_ticket_promise_time,i_section_id,i_address_id,i_revcenter_id,manual_hold,choice_hold,preauth_amount,cover_count,g_ticket_id,rv_Ticket,dt_recent_guest_check_print,i_location_id,s_cached_xml,b_use_custom_status,s_custom_status,s_status,preauth_total_no_bar_tab,i_active_seat_count,dt_last_item_time,dt_last_payment_time,b_gratuity_removed) VALUES ('130249',2185,'Brown, Cyril',11.00,0.00,0.00,11.00,11.00,0.00,NULL,NULL,133,'2017-06-12 15:36:25.593','2017-06-12 15:37:45.483',1,NULL,NULL,NULL,133,0,0,133,NULL,160,11.00,0.00,16006,'1753-01-01 00:00:00.000',0,2185,2,0,0,0.00,1,'D30A69C3-E7E8-4E25-AB6D-C2FD2EDFF76C',0x000000000105CFAD,NULL,NULL,NULL,0,NULL,'FullyPaid',0.00,1,'2017-06-12 15:36:45.527','2017-06-12 15:37:44.847',0);
    INSERT INTO mytable(i_ticket_id,i_customer_id,s_table_name,c_items_total,c_taxes_total,c_discount_amount,c_grand_total,c_payment_total,c_auto_gratuity,f_auto_gratuity_pct,i_void_ticket_id,i_user_id,dt_create_time,dt_close_time,b_closed,dt_lock_time,i_lock_user_id,dt_cached_time,i_created_by_user_id,f_ticket_discount_factor,i_ticket_revision,i_ticket_actual_close_employee_id,c_ticket_tips,i_ticket_seq_number,c_ticket_display_subtotal,c_ticket_display_tax_total,i_ticket_timesheet_id,dt_ticket_promise_time,i_section_id,i_address_id,i_revcenter_id,manual_hold,choice_hold,preauth_amount,cover_count,g_ticket_id,rv_Ticket,dt_recent_guest_check_print,i_location_id,s_cached_xml,b_use_custom_status,s_custom_status,s_status,preauth_total_no_bar_tab,i_active_seat_count,dt_last_item_time,dt_last_payment_time,b_gratuity_removed) VALUES ('130250',481,'Cappuccilli, Allison',11.00,0.00,0.00,11.00,11.00,0.00,NULL,NULL,154,'2017-06-12 15:54:36.953','2017-06-12 15:54:49.270',1,NULL,NULL,NULL,154,0,0,154,NULL,161,11.00,0.00,16009,'1753-01-01 00:00:00.000',0,481,2,0,0,0.00,1,'2BD4CF2B-3078-46F6-AE0E-C162EB20821E',0x000000000105CD06,NULL,NULL,NULL,0,NULL,'FullyPaid',0.00,1,'2017-06-12 15:54:45.040','2017-06-12 15:54:48.643',0);
    INSERT INTO mytable(i_ticket_id,i_customer_id,s_table_name,c_items_total,c_taxes_total,c_discount_amount,c_grand_total,c_payment_total,c_auto_gratuity,f_auto_gratuity_pct,i_void_ticket_id,i_user_id,dt_create_time,dt_close_time,b_closed,dt_lock_time,i_lock_user_id,dt_cached_time,i_created_by_user_id,f_ticket_discount_factor,i_ticket_revision,i_ticket_actual_close_employee_id,c_ticket_tips,i_ticket_seq_number,c_ticket_display_subtotal,c_ticket_display_tax_total,i_ticket_timesheet_id,dt_ticket_promise_time,i_section_id,i_address_id,i_revcenter_id,manual_hold,choice_hold,preauth_amount,cover_count,g_ticket_id,rv_Ticket,dt_recent_guest_check_print,i_location_id,s_cached_xml,b_use_custom_status,s_custom_status,s_status,preauth_total_no_bar_tab,i_active_seat_count,dt_last_item_time,dt_last_payment_time,b_gratuity_removed) VALUES ('130251',3886,'Chapski, Kathy',9.00,0.00,0.00,9.00,9.00,0.00,NULL,NULL,154,'2017-06-12 15:58:25.397','2017-06-12 15:58:35.257',1,NULL,NULL,NULL,154,0,0,154,NULL,162,9.00,0.00,16009,'1753-01-01 00:00:00.000',0,3887,2,0,0,0.00,1,'2E65A20C-A0FE-4491-9E4F-35729644FE79',0x000000000105CD07,NULL,NULL,NULL,0,NULL,'FullyPaid',0.00,1,'2017-06-12 15:58:28.643','2017-06-12 15:58:34.607',0);
    INSERT INTO mytable(i_ticket_id,i_customer_id,s_table_name,c_items_total,c_taxes_total,c_discount_amount,c_grand_total,c_payment_total,c_auto_gratuity,f_auto_gratuity_pct,i_void_ticket_id,i_user_id,dt_create_time,dt_close_time,b_closed,dt_lock_time,i_lock_user_id,dt_cached_time,i_created_by_user_id,f_ticket_discount_factor,i_ticket_revision,i_ticket_actual_close_employee_id,c_ticket_tips,i_ticket_seq_number,c_ticket_display_subtotal,c_ticket_display_tax_total,i_ticket_timesheet_id,dt_ticket_promise_time,i_section_id,i_address_id,i_revcenter_id,manual_hold,choice_hold,preauth_amount,cover_count,g_ticket_id,rv_Ticket,dt_recent_guest_check_print,i_location_id,s_cached_xml,b_use_custom_status,s_custom_status,s_status,preauth_total_no_bar_tab,i_active_seat_count,dt_last_item_time,dt_last_payment_time,b_gratuity_removed) VALUES ('130252',3042,'Soares, Amber',5.00,0.00,0.00,5.00,5.00,0.00,NULL,NULL,154,'2017-06-12 15:58:46.727','2017-06-12 15:58:55.840',1,NULL,NULL,NULL,154,0,0,154,NULL,163,5.00,0.00,16009,'1753-01-01 00:00:00.000',0,3043,2,0,0,0.00,1,'05F4C67F-5F85-44BD-9498-BFCAD08635F3',0x000000000105CD08,NULL,NULL,NULL,0,NULL,'FullyPaid',0.00,1,'2017-06-12 15:58:51.333','2017-06-12 15:58:55.240',0);
    INSERT INTO mytable(i_ticket_id,i_customer_id,s_table_name,c_items_total,c_taxes_total,c_discount_amount,c_grand_total,c_payment_total,c_auto_gratuity,f_auto_gratuity_pct,i_void_ticket_id,i_user_id,dt_create_time,dt_close_time,b_closed,dt_lock_time,i_lock_user_id,dt_cached_time,i_created_by_user_id,f_ticket_discount_factor,i_ticket_revision,i_ticket_actual_close_employee_id,c_ticket_tips,i_ticket_seq_number,c_ticket_display_subtotal,c_ticket_display_tax_total,i_ticket_timesheet_id,dt_ticket_promise_time,i_section_id,i_address_id,i_revcenter_id,manual_hold,choice_hold,preauth_amount,cover_count,g_ticket_id,rv_Ticket,dt_recent_guest_check_print,i_location_id,s_cached_xml,b_use_custom_status,s_custom_status,s_status,preauth_total_no_bar_tab,i_active_seat_count,dt_last_item_time,dt_last_payment_time,b_gratuity_removed) VALUES ('130253',3787,'Sorlien, Zoe',8.00,0.00,0.00,8.00,8.00,0.00,NULL,NULL,133,'2017-06-12 16:03:16.243','2017-06-12 16:03:25.133',1,NULL,NULL,NULL,133,0,0,133,NULL,164,8.00,0.00,16006,'1753-01-01 00:00:00.000',0,3788,2,0,0,0.00,1,'8EE7723D-916E-40D1-944F-E27D483A46D9',0x000000000105CFAE,NULL,NULL,NULL,0,NULL,'FullyPaid',0.00,1,'2017-06-12 16:03:20.300','2017-06-12 16:03:24.540',0);
    INSERT INTO mytable(i_ticket_id,i_customer_id,s_table_name,c_items_total,c_taxes_total,c_discount_amount,c_grand_total,c_payment_total,c_auto_gratuity,f_auto_gratuity_pct,i_void_ticket_id,i_user_id,dt_create_time,dt_close_time,b_closed,dt_lock_time,i_lock_user_id,dt_cached_time,i_created_by_user_id,f_ticket_discount_factor,i_ticket_revision,i_ticket_actual_close_employee_id,c_ticket_tips,i_ticket_seq_number,c_ticket_display_subtotal,c_ticket_display_tax_total,i_ticket_timesheet_id,dt_ticket_promise_time,i_section_id,i_address_id,i_revcenter_id,manual_hold,choice_hold,preauth_amount,cover_count,g_ticket_id,rv_Ticket,dt_recent_guest_check_print,i_location_id,s_cached_xml,b_use_custom_status,s_custom_status,s_status,preauth_total_no_bar_tab,i_active_seat_count,dt_last_item_time,dt_last_payment_time,b_gratuity_removed) VALUES ('130254',3790,'Smith, Emma',9.00,0.00,0.00,9.00,9.00,0.00,NULL,NULL,176,'2017-06-12 16:13:01.620','2017-06-12 16:13:08.727',1,NULL,NULL,NULL,176,0,0,176,NULL,165,9.00,0.00,16010,'1753-01-01 00:00:00.000',0,3791,2,0,0,0.00,1,'E39824B6-925D-4980-B1BB-BBE4552C04F2',0x000000000105CE08,NULL,NULL,NULL,0,NULL,'FullyPaid',0.00,1,'2017-06-12 16:13:03.563','2017-06-12 16:13:07.920',0);
    INSERT INTO mytable(i_ticket_id,i_customer_id,s_table_name,c_items_total,c_taxes_total,c_discount_amount,c_grand_total,c_payment_total,c_auto_gratuity,f_auto_gratuity_pct,i_void_ticket_id,i_user_id,dt_create_time,dt_close_time,b_closed,dt_lock_time,i_lock_user_id,dt_cached_time,i_created_by_user_id,f_ticket_discount_factor,i_ticket_revision,i_ticket_actual_close_employee_id,c_ticket_tips,i_ticket_seq_number,c_ticket_display_subtotal,c_ticket_display_tax_total,i_ticket_timesheet_id,dt_ticket_promise_time,i_section_id,i_address_id,i_revcenter_id,manual_hold,choice_hold,preauth_amount,cover_count,g_ticket_id,rv_Ticket,dt_recent_guest_check_print,i_location_id,s_cached_xml,b_use_custom_status,s_custom_status,s_status,preauth_total_no_bar_tab,i_active_seat_count,dt_last_item_time,dt_last_payment_time,b_gratuity_removed) VALUES ('130255',1369,'REED, BOB',20.00,0.00,0.00,20.00,20.00,0.00,NULL,NULL,176,'2017-06-12 16:15:45.210','2017-06-12 16:17:12.033',1,NULL,NULL,NULL,176,0,0,176,NULL,166,20.00,0.00,16010,'1753-01-01 00:00:00.000',0,1369,2,0,0,0.00,1,'07098FA2-77D1-4C48-AD51-7AEB33308D2B',0x000000000105CE09,NULL,NULL,NULL,0,NULL,'FullyPaid',0.00,1,'2017-06-12 16:16:52.343','2017-06-12 16:17:11.300',0);
    INSERT INTO mytable(i_ticket_id,i_customer_id,s_table_name,c_items_total,c_taxes_total,c_discount_amount,c_grand_total,c_payment_total,c_auto_gratuity,f_auto_gratuity_pct,i_void_ticket_id,i_user_id,dt_create_time,dt_close_time,b_closed,dt_lock_time,i_lock_user_id,dt_cached_time,i_created_by_user_id,f_ticket_discount_factor,i_ticket_revision,i_ticket_actual_close_employee_id,c_ticket_tips,i_ticket_seq_number,c_ticket_display_subtotal,c_ticket_display_tax_total,i_ticket_timesheet_id,dt_ticket_promise_time,i_section_id,i_address_id,i_revcenter_id,manual_hold,choice_hold,preauth_amount,cover_count,g_ticket_id,rv_Ticket,dt_recent_guest_check_print,i_location_id,s_cached_xml,b_use_custom_status,s_custom_status,s_status,preauth_total_no_bar_tab,i_active_seat_count,dt_last_item_time,dt_last_payment_time,b_gratuity_removed) VALUES ('130256',3887,'Smith, Chris',9.00,0.00,0.00,9.00,9.00,0.00,NULL,NULL,1,'2017-06-13 09:00:21.150','2017-06-13 09:00:33.923',1,NULL,NULL,NULL,1,0,0,1,NULL,1,9.00,0.00,16014,'1753-01-01 00:00:00.000',0,3888,2,0,0,0.00,1,'5815A088-D1EC-4F39-9778-5305130235C0',0x000000000105DCE4,NULL,NULL,NULL,0,NULL,'FullyPaid',0.00,1,'2017-06-13 09:00:24.520','2017-06-13 09:00:33.723',0);
    INSERT INTO mytable(i_ticket_id,i_customer_id,s_table_name,c_items_total,c_taxes_total,c_discount_amount,c_grand_total,c_payment_total,c_auto_gratuity,f_auto_gratuity_pct,i_void_ticket_id,i_user_id,dt_create_time,dt_close_time,b_closed,dt_lock_time,i_lock_user_id,dt_cached_time,i_created_by_user_id,f_ticket_discount_factor,i_ticket_revision,i_ticket_actual_close_employee_id,c_ticket_tips,i_ticket_seq_number,c_ticket_display_subtotal,c_ticket_display_tax_total,i_ticket_timesheet_id,dt_ticket_promise_time,i_section_id,i_address_id,i_revcenter_id,manual_hold,choice_hold,preauth_amount,cover_count,g_ticket_id,rv_Ticket,dt_recent_guest_check_print,i_location_id,s_cached_xml,b_use_custom_status,s_custom_status,s_status,preauth_total_no_bar_tab,i_active_seat_count,dt_last_item_time,dt_last_payment_time,b_gratuity_removed) VALUES ('130257',0,'InPayments #2',9.00,0.00,0.00,9.00,9.00,0.00,NULL,NULL,1,'2017-06-13 09:00:52.883','2017-06-13 09:00:54.213',1,NULL,NULL,'2017-06-13 09:43:16.370',1,0,0,1,NULL,2,9.00,0.00,16014,'1753-01-01 00:00:00.000',0,0,2,0,0,0.00,1,'F9212DE4-1FB9-41A2-9D7C-B3C11BE1D2A4',0x000000000105DCE5,NULL,NULL,'<Ticket xmlns="http://schemas.datacontract.org/2004/07/Dinerware" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><InstanceGuid>f9212de4-1fb9-41a2-9d7c-b3c11be1d2a4</InstanceGuid><ActiveSeatcount>1</ActiveSeatcount><AutoGratApplicableAmount>9.00</AutoGratApplicableAmount><CloseTime>2017-06-13T09:00:54.213-07:00</CloseTime><CoverCount>1</CoverCount><CreateTime>2017-06-13T09:00:52.883-07:00</CreateTime><CustomStatus/><Discounts/><FastPayCashDrawer/><FirstItemTime>2017-06-13T09:00:52.89-07:00</FirstItemTime><Gratuity><Amount>0</Amount><ManualAmount>false</ManualAmount><Percent>0</Percent><Removed>false</Removed></Gratuity><ID>130257</ID><LastGuestCheckPrint>0001-01-01T00:00:00</LastGuestCheckPrint><LastItemTime>2017-06-13T09:00:48.763-07:00</LastItemTime><LastPaymentTime>2017-06-13T09:00:54.08-07:00</LastPaymentTime><LocationID>0</LocationID><Memberships/><OwnerID>1</OwnerID><PaymentTotal>9.0000</PaymentTotal><Payments/><PotentialSurcharges/><PromiseTime>1753-01-01T00:00:00</PromiseTime><RealSubtotal>9.0000</RealSubtotal><RevCenterId>2</RevCenterId><RevCenterName>Nutrition Club</RevCenterName><Seats><Cover><Id>74647</Id><Index>1</Index><Selected>false</Selected><TicketItems><MenuItem><InstanceGuid>62f4d307-f115-4504-8e9c-6e06e345827f</InstanceGuid><Active>false</Active><AlwaysShowSpecialRequest>false</AlwaysShowSpecialRequest><ApplicableTicketDiscountsString/><ApplicableTicketTaxesString/><ChoiceCats><ChoiceCategory><Active>false</Active><AlternateKprintName/><BartenderExemption>false</BartenderExemption><CatQuantityBehavior>SameAsParent</CatQuantityBehavior><CategoryName>TEA FLAVOR:</CategoryName><Choices><Choice><Active>true</Active><ChoiceAlternateKprintName/><ChoiceCategories/><ChoiceName>Cinnamon Tea Cold</ChoiceName><Cost>0</Cost><CourseID>0</CourseID><ID>133</ID><OriginalQuantity>1.0000</OriginalQuantity><OriginalShareQuantity>1</OriginalShareQuantity><OverrideCategoryPrice>false</OverrideCategoryPrice><PriceModifier>0</PriceModifier><PriceModifierPct>0</PriceModifierPct><PrintRed>false</PrintRed><Quantity>1.0000</Quantity><SKU i:nil="true"/><TicketChoiceID>162941</TicketChoiceID><TimeAdded>2017-06-13T09:00:50.863-07:00</TimeAdded><UsesPercent>false</UsesPercent></Choice></Choices><ID>25</ID><InheritPricing>false</InheritPricing><InstanceID>369317</InstanceID><IsOptional>false</IsOptional><MaxChoiceQty>1</MaxChoiceQty><MinChoiceQty>1</MinChoiceQty><MultiSelect>false</MultiSelect><ParentChoiceInstanceID/><PrependName>false</PrependName><PriceModifier>0</PriceModifier><PriceModifierPct>0</PriceModifierPct><PrintRed>false</PrintRed><Timid>false</Timid><UsesPercent>false</UsesPercent></ChoiceCategory><ChoiceCategory><Active>false</Active><AlternateKprintName/><BartenderExemption>false</BartenderExemption><CatQuantityBehavior>SameAsParent</CatQuantityBehavior><CategoryName>ALOE SHOT:</CategoryName><Choices><Choice><Active>true</Active><ChoiceAlternateKprintName/><ChoiceCategories/><ChoiceName>Cranberry Aloe Shot</ChoiceName><Cost>0</Cost><CourseID>0</CourseID><ID>119</ID><OriginalQuantity>1.0000</OriginalQuantity><OriginalShareQuantity>1</OriginalShareQuantity><OverrideCategoryPrice>false</OverrideCategoryPrice><PriceModifier>0</PriceModifier><PriceModifierPct>0</PriceModifierPct><PrintRed>false</PrintRed><Quantity>1.0000</Quantity><SKU i:nil="true"/><TicketChoiceID>162942</TicketChoiceID><TimeAdded>2017-06-13T09:00:51.6-07:00</TimeAdded><UsesPercent>false</UsesPercent></Choice></Choices><ID>26</ID><InheritPricing>false</InheritPricing><InstanceID>369318</InstanceID><IsOptional>false</IsOptional><MaxChoiceQty>1</MaxChoiceQty><MinChoiceQty>1</MinChoiceQty><MultiSelect>false</MultiSelect><ParentChoiceInstanceID/><PrependName>false</PrependName><PriceModifier>0</PriceModifier><PriceModifierPct>0</PriceModifierPct><PrintRed>false</PrintRed><Timid>false</Timid><UsesPercent>false</UsesPercent></ChoiceCategory><ChoiceCategory><Active>true</Active><AlternateKprintName/><BartenderExemption>false</BartenderExemption><CatQuantityBehavior>SameAsParent</CatQuantityBehavior><CategoryName>PROTEIN SUBSTITUTION:</CategoryName><Choices/><DefaultChoiceID>0</DefaultChoiceID><ID>27</ID><InheritPricing>true</InheritPricing><InstanceID/><IsOptional>true</IsOptional><MaxChoiceQty>1</MaxChoiceQty><MinChoiceQty>1</MinChoiceQty><MultiSelect>false</MultiSelect><Ordinal>9</Ordinal><ParentChoiceInstanceID/><PrependName>true</PrependName><PriceModifier>0</PriceModifier><PriceModifierPct>0</PriceModifierPct><PrintRed>false</PrintRed><Timid>true</Timid><UsesPercent>false</UsesPercent></ChoiceCategory><ChoiceCategory><Active>true</Active><AlternateKprintName/><BartenderExemption>false</BartenderExemption><CatQuantityBehavior>SameAsParent</CatQuantityBehavior><CategoryName>UPGRADES:</CategoryName><Choices/><DefaultChoiceID>0</DefaultChoiceID><ID>21</ID><InheritPricing>false</InheritPricing><InstanceID/><IsOptional>true</IsOptional><MaxChoiceQty>1</MaxChoiceQty><MinChoiceQty>1</MinChoiceQty><MultiSelect>false</MultiSelect><Ordinal>10</Ordinal><ParentChoiceInstanceID/><PrependName>true</PrependName><PriceModifier>0</PriceModifier><PriceModifierPct>0</PriceModifierPct><PrintRed>false</PrintRed><Timid>false</Timid><UsesPercent>false</UsesPercent></ChoiceCategory><ChoiceCategory><Active>true</Active><AlternateKprintName/><BartenderExemption>false</BartenderExemption><CatQuantityBehavior>SameAsParent</CatQuantityBehavior><CategoryName>ADD:</CategoryName><Choices/><DefaultChoiceID>0</DefaultChoiceID><ID>24</ID><InheritPricing>false</InheritPricing><InstanceID/><IsOptional>true</IsOptional><MaxChoiceQty>1</MaxChoiceQty><MinChoiceQty>1</MinChoiceQty><MultiSelect>true</MultiSelect><Ordinal>11</Ordinal><ParentChoiceInstanceID/><PrependName>true</PrependName><PriceModifier>0</PriceModifier><PriceModifierPct>0</PriceModifierPct><PrintRed>false</PrintRed><Timid>false</Timid><UsesPercent>false</UsesPercent></ChoiceCategory></ChoiceCats><Choices><Choice><Active>true</Active><ChoiceAlternateKprintName/><ChoiceCategories/><ChoiceName>Cinnamon Tea Cold</ChoiceName><Cost>0</Cost><CourseID>0</CourseID><ID>133</ID><OriginalQuantity>1.0000</OriginalQuantity><OriginalShareQuantity>1</OriginalShareQuantity><OverrideCategoryPrice>false</OverrideCategoryPrice><PriceModifier>0</PriceModifier><PriceModifierPct>0</PriceModifierPct><PrintRed>false</PrintRed><Quantity>1.0000</Quantity><SKU i:nil="true"/><TicketChoiceID>162941</TicketChoiceID><TimeAdded>2017-06-13T09:00:50.863-07:00</TimeAdded><UsesPercent>false</UsesPercent></Choice><Choice><Active>true</Active><ChoiceAlternateKprintName/><ChoiceCategories/><ChoiceName>Cranberry Aloe Shot</ChoiceName><Cost>0</Cost><CourseID>0</CourseID><ID>119</ID><OriginalQuantity>1.0000</OriginalQuantity><OriginalShareQuantity>1</OriginalShareQuantity><OverrideCategoryPrice>false</OverrideCategoryPrice><PriceModifier>0</PriceModifier><PriceModifierPct>0</PriceModifierPct><PrintRed>false</PrintRed><Quantity>1.0000</Quantity><SKU i:nil="true"/><TicketChoiceID>162942</TicketChoiceID><TimeAdded>2017-06-13T09:00:51.6-07:00</TimeAdded><UsesPercent>false</UsesPercent></Choice></Choices><CommitTime>2017-06-13T09:00:52.89-07:00</CommitTime><Cost>0</Cost><DecimalSplit>1</DecimalSplit><DefaultQuantity>1</DefaultQuantity><Description/><Discounts/><DisplayPrice>9.0000</DisplayPrice><ExpandedPrice>9.0000</ExpandedPrice><FractionSplit>1</FractionSplit><ID>505</ID><ItemName>Samoas</ItemName><MenuDescription/><NoPrint>false</NoPrint><OpenItem>false</OpenItem><OriginalAddTime>2017-06-13T09:00:48.763-07:00</OriginalAddTime><Price>9.0000</Price><PriceCatID>46</PriceCatID><PriceLevelChoiceCategory>-1</PriceLevelChoiceCategory><PriceXQuantity>9.0000</PriceXQuantity><Quantity>1</Quantity><RealQty>1</RealQty><RevenueCenterID>2</RevenueCenterID><RevenueCenterName>Nutrition Club</RevenueCenterName><RevenueClassID>12</RevenueClassID><RevenueClassName>Shakes</RevenueClassName><SKU/><SoldByWeight>false</SoldByWeight><SpecialGrossWithOnlyHiddenTaxRemoved>9.0000</SpecialGrossWithOnlyHiddenTaxRemoved><SpecialRequest/><SplitGroup>1</SplitGroup><TIID>579175</TIID><TareWeight>0</TareWeight><Taxes/><UsesFixedPrice>false</UsesFixedPrice></MenuItem></TicketItems></Cover></Seats><SequenceNum>2</SequenceNum><Status>FullyPaid</Status><Subtotal>9.0000</Subtotal><TableName>InPayments #2</TableName><Taxes><Tax><Active>true</Active><AddInData/><AppliesAll>false</AppliesAll><AppliesGratuity>true</AppliesGratuity><ExtraHeaderLineText/><ExtraHeaderLineTwo/><ExtraHeaderOnGuestChecks>false</ExtraHeaderOnGuestChecks><ExtraHeaderOnReceipts>false</ExtraHeaderOnReceipts><FlatFeeAmount>0</FlatFeeAmount><GratuityAppliesAfterVAT>false</GratuityAppliesAfterVAT><HiddenTaxOrder>-1</HiddenTaxOrder><HideWhenAllLiquor>false</HideWhenAllLiquor><ID>16</ID><Inclusive>false</Inclusive><IsFloridaTax>false</IsFloridaTax><IsProRatedInstance>false</IsProRatedInstance><IsVAT>false</IsVAT><Level>1</Level><MarkCharacter/><MarkItems>false</MarkItems><MarkLegend/><MenuItemIDs xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays"/><NonLiquor>false</NonLiquor><PerPersonThreshold>false</PerPersonThreshold><PerPersonThresholdAmount>0</PerPersonThresholdAmount><Percent>0.07</Percent><RCThreshold>false</RCThreshold><RCThresholdAmount>0</RCThresholdAmount><RateName>7% Tax (Catalog)</RateName><Reason/><RemovedAmount>0</RemovedAmount><RevClassIDs xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays"><a:int>11</a:int></RevClassIDs><RevenueCenterIds xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays"/><RoundingType>normal</RoundingType><SectionIds xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays"/><ShowActualPrice>false</ShowActualPrice><ShowExtraHeaderLine>false</ShowExtraHeaderLine><ShowSubtotalLine>true</ShowSubtotalLine><SubtotalLineText>Tax + S&amp;H</SubtotalLineText><TotalAmount>0</TotalAmount><UsesFlatFee>false</UsesFlatFee><isTicketLevel>false</isTicketLevel></Tax></Taxes><Total>9.0000</Total><UseCustomStatus>false</UseCustomStatus><UserID>1</UserID><UserName/></Ticket>',0,NULL,'FullyPaid',0.00,1,'2017-06-13 09:00:48.763','2017-06-13 09:00:54.080',0);
    INSERT INTO mytable(i_ticket_id,i_customer_id,s_table_name,c_items_total,c_taxes_total,c_discount_amount,c_grand_total,c_payment_total,c_auto_gratuity,f_auto_gratuity_pct,i_void_ticket_id,i_user_id,dt_create_time,dt_close_time,b_closed,dt_lock_time,i_lock_user_id,dt_cached_time,i_created_by_user_id,f_ticket_discount_factor,i_ticket_revision,i_ticket_actual_close_employee_id,c_ticket_tips,i_ticket_seq_number,c_ticket_display_subtotal,c_ticket_display_tax_total,i_ticket_timesheet_id,dt_ticket_promise_time,i_section_id,i_address_id,i_revcenter_id,manual_hold,choice_hold,preauth_amount,cover_count,g_ticket_id,rv_Ticket,dt_recent_guest_check_print,i_location_id,s_cached_xml,b_use_custom_status,s_custom_status,s_status,preauth_total_no_bar_tab,i_active_seat_count,dt_last_item_time,dt_last_payment_time,b_gratuity_removed) VALUES ('130258',3887,'InPayments #3',4.00,0.00,0.00,4.00,4.00,0.00,NULL,NULL,1,'2017-06-13 09:37:39.773','2017-06-13 09:37:41.190',1,NULL,NULL,'2017-06-13 09:43:18.107',1,0,0,1,NULL,3,4.00,0.00,16014,'1753-01-01 00:00:00.000',0,3888,2,0,0,0.00,1,'707A5E08-715E-4DA8-9D3B-24FBEC6B0842',0x000000000105DCE6,NULL,NULL,'<Ticket xmlns="http://schemas.datacontract.org/2004/07/Dinerware" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><InstanceGuid>707a5e08-715e-4da8-9d3b-24fbec6b0842</InstanceGuid><ActiveSeatcount>1</ActiveSeatcount><AddressID>3888</AddressID><AutoGratApplicableAmount>4.00</AutoGratApplicableAmount><CloseTime>2017-06-13T09:37:41.19-07:00</CloseTime><CoverCount>1</CoverCount><CreateTime>2017-06-13T09:37:39.773-07:00</CreateTime><CustomStatus/><Customer><InstanceGuid>d71f6c6e-da19-40e2-b731-adf3b3066e69</InstanceGuid><Active>true</Active><Anniversary>1900-01-01T00:00:00-08:00</Anniversary><Birthday>1900-01-01T00:00:00-08:00</Birthday><CallerID/><CurrentId>3887</CurrentId><DateAdded>2017-06-13T09:00:16.32-07:00</DateAdded><DateEdited>2017-06-13T09:00:16.32-07:00</DateEdited><EditedByUserId>1</EditedByUserId><EditedByUserName>InPayments</EditedByUserName><Email/><Email2/><FName>Chris</FName><ID>3887</ID><IsAnonymous>false</IsAnonymous><IsChanged>true</IsChanged><IsDeleted>false</IsDeleted><IsNew>false</IsNew><LName>Smith</LName><MembershipCardInfo/><MembershipID>156156</MembershipID><Notes/><OriginalId>3887</OriginalId><Phone>7075673304</Phone><theAddresses><Address><Address1>1060 Elfstone Ct</Address1><Address2/><AddressType/><City>Westlake Village</City><CurrentId>3888</CurrentId><ID>3888</ID><IsActive>true</IsActive><IsChanged>true</IsChanged><IsDeleted>false</IsDeleted><IsNew>false</IsNew><Name/><Note/><OriginalId>3888</OriginalId><PersonID>3887</PersonID><Phone/><PostalCode>91361</PostalCode><State>CA</State><SupercededById>-1</SupercededById></Address></theAddresses></Customer><Discounts/><FastPayCashDrawer/><FirstItemTime>2017-06-13T09:37:39.78-07:00</FirstItemTime><Gratuity><Amount>0</Amount><ManualAmount>false</ManualAmount><Percent>0</Percent><Removed>false</Removed></Gratuity><ID>130258</ID><LastGuestCheckPrint>0001-01-01T00:00:00</LastGuestCheckPrint><LastItemTime>2017-06-13T09:37:18.153-07:00</LastItemTime><LastPaymentTime>2017-06-13T09:37:41.06-07:00</LastPaymentTime><LocationID>0</LocationID><Memberships/><OwnerID>1</OwnerID><PaymentTotal>4.0000</PaymentTotal><Payments/><PotentialSurcharges/><PromiseTime>1753-01-01T00:00:00</PromiseTime><RealSubtotal>4.0000</RealSubtotal><RevCenterId>2</RevCenterId><RevCenterName>Nutrition Club</RevCenterName><Seats><Cover><Id>74648</Id><Index>1</Index><Selected>false</Selected><TicketItems><MenuItem><InstanceGuid>f0caaca7-d47f-4536-9f4c-6a4fd53f8696</InstanceGuid><Active>false</Active><AlwaysShowSpecialRequest>false</AlwaysShowSpecialRequest><ApplicableTicketDiscountsString/><ApplicableTicketTaxesString/><ChoiceCats/><Choices/><CommitTime>2017-06-13T09:37:39.78-07:00</CommitTime><Cost>0</Cost><DecimalSplit>1</DecimalSplit><DefaultQuantity>1</DefaultQuantity><Description/><Discounts/><DisplayPrice>2.0000</DisplayPrice><ExpandedPrice>2.0000</ExpandedPrice><FractionSplit>1</FractionSplit><ID>541</ID><ItemName>Orange H3O</ItemName><MenuDescription/><NoPrint>false</NoPrint><OpenItem>false</OpenItem><OriginalAddTime>2017-06-13T09:37:17.58-07:00</OriginalAddTime><Price>2.0000</Price><PriceCatID>-1</PriceCatID><PriceLevelChoiceCategory>-1</PriceLevelChoiceCategory><PriceXQuantity>2.0000</PriceXQuantity><Quantity>1</Quantity><RealQty>1</RealQty><RevenueCenterID>2</RevenueCenterID><RevenueCenterName>Nutrition Club</RevenueCenterName><RevenueClassID>18</RevenueClassID><RevenueClassName>Functional</RevenueClassName><SKU/><SoldByWeight>false</SoldByWeight><SpecialGrossWithOnlyHiddenTaxRemoved>2.0000</SpecialGrossWithOnlyHiddenTaxRemoved><SpecialRequest/><SplitGroup>1</SplitGroup><TIID>579176</TIID><TareWeight>0</TareWeight><Taxes/><UsesFixedPrice>false</UsesFixedPrice></MenuItem><MenuItem><InstanceGuid>db44e614-1487-4e2c-8787-e9aeafe9cd1f</InstanceGuid><Active>false</Active><AlwaysShowSpecialRequest>false</AlwaysShowSpecialRequest><ApplicableTicketDiscountsString/><ApplicableTicketTaxesString/><ChoiceCats/><Choices/><CommitTime>2017-06-13T09:37:39.787-07:00</CommitTime><Cost>0</Cost><DecimalSplit>1</DecimalSplit><DefaultQuantity>1</DefaultQuantity><Description/><Discounts/><DisplayPrice>2.0000</DisplayPrice><ExpandedPrice>2.0000</ExpandedPrice><FractionSplit>1</FractionSplit><ID>541</ID><ItemName>Orange H3O</ItemName><MenuDescription/><NoPrint>false</NoPrint><OpenItem>false</OpenItem><OriginalAddTime>2017-06-13T09:37:18.153-07:00</OriginalAddTime><Price>2.0000</Price><PriceCatID>-1</PriceCatID><PriceLevelChoiceCategory>-1</PriceLevelChoiceCategory><PriceXQuantity>2.0000</PriceXQuantity><Quantity>1</Quantity><RealQty>1</RealQty><RevenueCenterID>2</RevenueCenterID><RevenueCenterName>Nutrition Club</RevenueCenterName><RevenueClassID>18</RevenueClassID><RevenueClassName>Functional</RevenueClassName><SKU/><SoldByWeight>false</SoldByWeight><SpecialGrossWithOnlyHiddenTaxRemoved>2.0000</SpecialGrossWithOnlyHiddenTaxRemoved><SpecialRequest/><SplitGroup>2</SplitGroup><TIID>579177</TIID><TareWeight>0</TareWeight><Taxes/><UsesFixedPrice>false</UsesFixedPrice></MenuItem></TicketItems></Cover></Seats><SequenceNum>3</SequenceNum><Status>FullyPaid</Status><Subtotal>4.0000</Subtotal><TableName>InPayments #3</TableName><Taxes><Tax><Active>true</Active><AddInData/><AppliesAll>false</AppliesAll><AppliesGratuity>true</AppliesGratuity><ExtraHeaderLineText/><ExtraHeaderLineTwo/><ExtraHeaderOnGuestChecks>false</ExtraHeaderOnGuestChecks><ExtraHeaderOnReceipts>false</ExtraHeaderOnReceipts><FlatFeeAmount>0</FlatFeeAmount><GratuityAppliesAfterVAT>false</GratuityAppliesAfterVAT><HiddenTaxOrder>-1</HiddenTaxOrder><HideWhenAllLiquor>false</HideWhenAllLiquor><ID>16</ID><Inclusive>false</Inclusive><IsFloridaTax>false</IsFloridaTax><IsProRatedInstance>false</IsProRatedInstance><IsVAT>false</IsVAT><Level>1</Level><MarkCharacter/><MarkItems>false</MarkItems><MarkLegend/><MenuItemIDs xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays"/><NonLiquor>false</NonLiquor><PerPersonThreshold>false</PerPersonThreshold><PerPersonThresholdAmount>0</PerPersonThresholdAmount><Percent>0.07</Percent><RCThreshold>false</RCThreshold><RCThresholdAmount>0</RCThresholdAmount><RateName>7% Tax (Catalog)</RateName><Reason/><RemovedAmount>0</RemovedAmount><RevClassIDs xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays"><a:int>11</a:int></RevClassIDs><RevenueCenterIds xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays"/><RoundingType>normal</RoundingType><SectionIds xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays"/><ShowActualPrice>false</ShowActualPrice><ShowExtraHeaderLine>false</ShowExtraHeaderLine><ShowSubtotalLine>true</ShowSubtotalLine><SubtotalLineText>Tax + S&amp;H</SubtotalLineText><TotalAmount>0</TotalAmount><UsesFlatFee>false</UsesFlatFee><isTicketLevel>false</isTicketLevel></Tax></Taxes><Total>4.0000</Total><UseCustomStatus>false</UseCustomStatus><UserID>1</UserID><UserName/></Ticket>',0,NULL,'FullyPaid',0.00,1,'2017-06-13 09:37:18.153','2017-06-13 09:37:41.060',0);
    INSERT INTO mytable(i_ticket_id,i_customer_id,s_table_name,c_items_total,c_taxes_total,c_discount_amount,c_grand_total,c_payment_total,c_auto_gratuity,f_auto_gratuity_pct,i_void_ticket_id,i_user_id,dt_create_time,dt_close_time,b_closed,dt_lock_time,i_lock_user_id,dt_cached_time,i_created_by_user_id,f_ticket_discount_factor,i_ticket_revision,i_ticket_actual_close_employee_id,c_ticket_tips,i_ticket_seq_number,c_ticket_display_subtotal,c_ticket_display_tax_total,i_ticket_timesheet_id,dt_ticket_promise_time,i_section_id,i_address_id,i_revcenter_id,manual_hold,choice_hold,preauth_amount,cover_count,g_ticket_id,rv_Ticket,dt_recent_guest_check_print,i_location_id,s_cached_xml,b_use_custom_status,s_custom_status,s_status,preauth_total_no_bar_tab,i_active_seat_count,dt_last_item_time,dt_last_payment_time,b_gratuity_removed) VALUES ('130259',3887,'InPayments #4',2.00,0.00,0.00,2.00,2.00,0.00,NULL,NULL,1,'2017-06-13 09:43:55.637','2017-06-13 09:43:57.067',1,NULL,NULL,NULL,1,0,0,1,NULL,5,2.00,0.00,16014,'1753-01-01 00:00:00.000',0,3888,2,0,0,0.00,1,'72A093C5-2BB8-4122-AD23-4859DCF3A13F',0x000000000105DCE7,NULL,NULL,NULL,0,NULL,'FullyPaid',0.00,1,'2017-06-13 09:43:41.653','2017-06-13 09:43:56.980',0);
    INSERT INTO mytable(i_ticket_id,i_customer_id,s_table_name,c_items_total,c_taxes_total,c_discount_amount,c_grand_total,c_payment_total,c_auto_gratuity,f_auto_gratuity_pct,i_void_ticket_id,i_user_id,dt_create_time,dt_close_time,b_closed,dt_lock_time,i_lock_user_id,dt_cached_time,i_created_by_user_id,f_ticket_discount_factor,i_ticket_revision,i_ticket_actual_close_employee_id,c_ticket_tips,i_ticket_seq_number,c_ticket_display_subtotal,c_ticket_display_tax_total,i_ticket_timesheet_id,dt_ticket_promise_time,i_section_id,i_address_id,i_revcenter_id,manual_hold,choice_hold,preauth_amount,cover_count,g_ticket_id,rv_Ticket,dt_recent_guest_check_print,i_location_id,s_cached_xml,b_use_custom_status,s_custom_status,s_status,preauth_total_no_bar_tab,i_active_seat_count,dt_last_item_time,dt_last_payment_time,b_gratuity_removed) VALUES ('130260',0,'Cashier Test #5',45.00,0.00,0.00,45.00,45.00,0.00,NULL,NULL,179,'2017-06-14 08:51:59.887','2017-06-14 08:52:01.790',1,NULL,NULL,NULL,179,0,0,179,NULL,1,45.00,0.00,16051,'1753-01-01 00:00:00.000',0,0,0,0,0,0.00,1,'4F02E42E-EACD-4E81-9A6D-72B7FE4702EA',0x000000000105E7AB,NULL,NULL,NULL,0,NULL,'FullyPaid',0.00,1,'2017-06-14 08:51:58.947','2017-06-14 08:52:01.567',0);


    CREATE TABLE TicketItem(
     i_ticket_item_id       INTEGER NOT NULL PRIMARY KEY
    ,i_ticket_id         DATE NOT NULL
    ,i_menu_item_id        INTEGER NOT NULL
    ,s_item          VARCHAR(22) NOT NULL
    ,dt_when          VARCHAR(23) NOT NULL
    ,c_price          NUMERIC(4,2) NOT NULL
    ,c_discount_amount       NUMERIC(4,2) NOT NULL
    ,c_tax_total         VARCHAR(4)
    ,i_employee_id        INTEGER NOT NULL
    ,i_cover_id         INTEGER NOT NULL
    ,i_void_item_id        VARCHAR(4)
    ,i_held          BIT NOT NULL
    ,b_printed         VARCHAR(4)
    ,i_split_group        INTEGER NOT NULL
    ,f_split          BIT NOT NULL
    ,i_held_for_choice       BIT NOT NULL
    ,s_qty           BIT NOT NULL
    ,c_ticketitem_choices_amount   NUMERIC(4,2) NOT NULL
    ,c_ticketitem_net_price     NUMERIC(4,2) NOT NULL
    ,f_ticketitem_ticket_discount_factor BIT NOT NULL
    ,i_ticketitem_actual_employee_id  INTEGER NOT NULL
    ,c_ticketitem_tip_share     VARCHAR(4)
    ,f_ticketitem_share_qty     BIT NOT NULL
    ,f_ticketitem_real_qty     BIT NOT NULL
    ,i_ticketitem_timesheet_id    INTEGER NOT NULL
    ,c_ticketitem_gross_price    NUMERIC(4,2) NOT NULL
    ,c_ticketitem_manual_discounts   NUMERIC(4,2) NOT NULL
    ,c_ticketitem_auto_discounts   NUMERIC(4,2) NOT NULL
    ,i_ti_customer_id       INTEGER NOT NULL
    ,i_ti_void_ticket_id      VARCHAR(4)
    ,i_ti_customer_orig_id     INTEGER
    ,dt_ti_ticket_close_time     VARCHAR(23) NOT NULL
    ,i_ti_revcenter_id       INTEGER NOT NULL
    ,c_hidden_taxes        NUMERIC(4,2) NOT NULL
    ,i_course_id         BIT NOT NULL
    ,original_add_time       VARCHAR(23) NOT NULL
    ,s_applicable_ticket_discounts   VARCHAR(30)
    ,s_applicable_ticket_taxes    VARCHAR(30)
    ,s_special_request       VARCHAR(30)
    ,g_ticketitem_id       VARCHAR(36) NOT NULL
    ,c_autograt_amount       NUMERIC(4,2) NOT NULL
    ,rv_TicketItem        INTEGER NOT NULL
    ,g_combination_guid      VARCHAR(36) NOT NULL
    );
    INSERT INTO mytable(i_ticket_item_id,i_ticket_id,i_menu_item_id,s_item,dt_when,c_price,c_discount_amount,c_tax_total,i_employee_id,i_cover_id,i_void_item_id,i_held,b_printed,i_split_group,f_split,i_held_for_choice,s_qty,c_ticketitem_choices_amount,c_ticketitem_net_price,f_ticketitem_ticket_discount_factor,i_ticketitem_actual_employee_id,c_ticketitem_tip_share,f_ticketitem_share_qty,f_ticketitem_real_qty,i_ticketitem_timesheet_id,c_ticketitem_gross_price,c_ticketitem_manual_discounts,c_ticketitem_auto_discounts,i_ti_customer_id,i_ti_void_ticket_id,i_ti_customer_orig_id,dt_ti_ticket_close_time,i_ti_revcenter_id,c_hidden_taxes,i_course_id,original_add_time,s_applicable_ticket_discounts,s_applicable_ticket_taxes,s_special_request,g_ticketitem_id,c_autograt_amount,rv_TicketItem,g_combination_guid) VALUES (579166,'130251',522,'Wedding Cake','2017-06-12 15:58:32.403',9.00,0.00,NULL,154,74641,NULL,0,NULL,1,1,0,1,0.00,9.00,0,154,NULL,1,1,16009,9.00,0.00,0.00,3886,NULL,3886,'2017-06-12 15:58:35.257',2,0.00,0,'2017-06-12 15:58:28.643',NULL,NULL,NULL,'0134C648-52B2-4D15-80F4-4D23354BF949',0.00,0x000000000105CD4A,'00000000-0000-0000-0000-000000000000');
    INSERT INTO mytable(i_ticket_item_id,i_ticket_id,i_menu_item_id,s_item,dt_when,c_price,c_discount_amount,c_tax_total,i_employee_id,i_cover_id,i_void_item_id,i_held,b_printed,i_split_group,f_split,i_held_for_choice,s_qty,c_ticketitem_choices_amount,c_ticketitem_net_price,f_ticketitem_ticket_discount_factor,i_ticketitem_actual_employee_id,c_ticketitem_tip_share,f_ticketitem_share_qty,f_ticketitem_real_qty,i_ticketitem_timesheet_id,c_ticketitem_gross_price,c_ticketitem_manual_discounts,c_ticketitem_auto_discounts,i_ti_customer_id,i_ti_void_ticket_id,i_ti_customer_orig_id,dt_ti_ticket_close_time,i_ti_revcenter_id,c_hidden_taxes,i_course_id,original_add_time,s_applicable_ticket_discounts,s_applicable_ticket_taxes,s_special_request,g_ticketitem_id,c_autograt_amount,rv_TicketItem,g_combination_guid) VALUES (579167,'130252',580,'Tea & Aloe','2017-06-12 15:58:53.283',3.00,0.00,NULL,154,74642,NULL,0,NULL,1,1,0,1,0.00,3.00,0,154,NULL,1,1,16009,3.00,0.00,0.00,3042,NULL,3042,'2017-06-12 15:58:55.840',2,0.00,0,'2017-06-12 15:58:48.160',NULL,NULL,NULL,'561CB11A-23EE-4036-9FA4-D0E7475EECA6',0.00,0x000000000105CD32,'00000000-0000-0000-0000-000000000000');
    INSERT INTO mytable(i_ticket_item_id,i_ticket_id,i_menu_item_id,s_item,dt_when,c_price,c_discount_amount,c_tax_total,i_employee_id,i_cover_id,i_void_item_id,i_held,b_printed,i_split_group,f_split,i_held_for_choice,s_qty,c_ticketitem_choices_amount,c_ticketitem_net_price,f_ticketitem_ticket_discount_factor,i_ticketitem_actual_employee_id,c_ticketitem_tip_share,f_ticketitem_share_qty,f_ticketitem_real_qty,i_ticketitem_timesheet_id,c_ticketitem_gross_price,c_ticketitem_manual_discounts,c_ticketitem_auto_discounts,i_ti_customer_id,i_ti_void_ticket_id,i_ti_customer_orig_id,dt_ti_ticket_close_time,i_ti_revcenter_id,c_hidden_taxes,i_course_id,original_add_time,s_applicable_ticket_discounts,s_applicable_ticket_taxes,s_special_request,g_ticketitem_id,c_autograt_amount,rv_TicketItem,g_combination_guid) VALUES (579168,'130252',545,'Liftoff','2017-06-12 15:58:53.303',2.00,0.00,NULL,154,74642,NULL,0,NULL,2,1,0,1,0.00,2.00,0,154,NULL,1,1,16009,2.00,0.00,0.00,3042,NULL,3042,'2017-06-12 15:58:55.840',2,0.00,0,'2017-06-12 15:58:51.333',NULL,NULL,NULL,'C13BDF3C-918A-4CA2-945A-21CC37D270A3',0.00,0x000000000105CD33,'00000000-0000-0000-0000-000000000000');
    INSERT INTO mytable(i_ticket_item_id,i_ticket_id,i_menu_item_id,s_item,dt_when,c_price,c_discount_amount,c_tax_total,i_employee_id,i_cover_id,i_void_item_id,i_held,b_printed,i_split_group,f_split,i_held_for_choice,s_qty,c_ticketitem_choices_amount,c_ticketitem_net_price,f_ticketitem_ticket_discount_factor,i_ticketitem_actual_employee_id,c_ticketitem_tip_share,f_ticketitem_share_qty,f_ticketitem_real_qty,i_ticketitem_timesheet_id,c_ticketitem_gross_price,c_ticketitem_manual_discounts,c_ticketitem_auto_discounts,i_ti_customer_id,i_ti_void_ticket_id,i_ti_customer_orig_id,dt_ti_ticket_close_time,i_ti_revcenter_id,c_hidden_taxes,i_course_id,original_add_time,s_applicable_ticket_discounts,s_applicable_ticket_taxes,s_special_request,g_ticketitem_id,c_autograt_amount,rv_TicketItem,g_combination_guid) VALUES (579169,'130253',720,'PL Cafe Latte','2017-06-12 16:03:22.943',8.00,0.00,NULL,133,74643,NULL,0,NULL,1,1,0,1,0.00,8.00,0,133,NULL,1,1,16006,8.00,0.00,0.00,3787,NULL,3787,'2017-06-12 16:03:25.133',2,0.00,0,'2017-06-12 16:03:20.300',NULL,NULL,NULL,'8EEB6E46-A2DE-4757-B36F-817BCAF2D895',0.00,0x000000000105D009,'00000000-0000-0000-0000-000000000000');
    INSERT INTO mytable(i_ticket_item_id,i_ticket_id,i_menu_item_id,s_item,dt_when,c_price,c_discount_amount,c_tax_total,i_employee_id,i_cover_id,i_void_item_id,i_held,b_printed,i_split_group,f_split,i_held_for_choice,s_qty,c_ticketitem_choices_amount,c_ticketitem_net_price,f_ticketitem_ticket_discount_factor,i_ticketitem_actual_employee_id,c_ticketitem_tip_share,f_ticketitem_share_qty,f_ticketitem_real_qty,i_ticketitem_timesheet_id,c_ticketitem_gross_price,c_ticketitem_manual_discounts,c_ticketitem_auto_discounts,i_ti_customer_id,i_ti_void_ticket_id,i_ti_customer_orig_id,dt_ti_ticket_close_time,i_ti_revcenter_id,c_hidden_taxes,i_course_id,original_add_time,s_applicable_ticket_discounts,s_applicable_ticket_taxes,s_special_request,g_ticketitem_id,c_autograt_amount,rv_TicketItem,g_combination_guid) VALUES (579170,'130254',470,'German Chocolate Cake','2017-06-12 16:13:06.217',9.00,0.00,NULL,176,74644,NULL,0,NULL,1,1,0,1,0.00,9.00,0,176,NULL,1,1,16010,9.00,0.00,0.00,3790,NULL,3790,'2017-06-12 16:13:08.727',2,0.00,0,'2017-06-12 16:13:03.563',NULL,NULL,NULL,'6299905E-C3A7-4AA4-98A2-0C1045EB3198',0.00,0x000000000105CE2B,'00000000-0000-0000-0000-000000000000');
    INSERT INTO mytable(i_ticket_item_id,i_ticket_id,i_menu_item_id,s_item,dt_when,c_price,c_discount_amount,c_tax_total,i_employee_id,i_cover_id,i_void_item_id,i_held,b_printed,i_split_group,f_split,i_held_for_choice,s_qty,c_ticketitem_choices_amount,c_ticketitem_net_price,f_ticketitem_ticket_discount_factor,i_ticketitem_actual_employee_id,c_ticketitem_tip_share,f_ticketitem_share_qty,f_ticketitem_real_qty,i_ticketitem_timesheet_id,c_ticketitem_gross_price,c_ticketitem_manual_discounts,c_ticketitem_auto_discounts,i_ti_customer_id,i_ti_void_ticket_id,i_ti_customer_orig_id,dt_ti_ticket_close_time,i_ti_revcenter_id,c_hidden_taxes,i_course_id,original_add_time,s_applicable_ticket_discounts,s_applicable_ticket_taxes,s_special_request,g_ticketitem_id,c_autograt_amount,rv_TicketItem,g_combination_guid) VALUES (579171,'130255',475,'Lemon Poppyseed Muffin','2017-06-12 16:17:03.703',9.00,0.00,NULL,176,74645,NULL,0,NULL,1,1,0,1,0.00,9.00,0,176,NULL,1,1,16010,9.00,0.00,0.00,1369,NULL,1369,'2017-06-12 16:17:12.033',2,0.00,0,'2017-06-12 16:16:06.797',NULL,NULL,NULL,'10523C18-2EF3-49C3-AF20-79F9B4003E27',0.00,0x000000000105CE0D,'00000000-0000-0000-0000-000000000000');
    INSERT INTO mytable(i_ticket_item_id,i_ticket_id,i_menu_item_id,s_item,dt_when,c_price,c_discount_amount,c_tax_total,i_employee_id,i_cover_id,i_void_item_id,i_held,b_printed,i_split_group,f_split,i_held_for_choice,s_qty,c_ticketitem_choices_amount,c_ticketitem_net_price,f_ticketitem_ticket_discount_factor,i_ticketitem_actual_employee_id,c_ticketitem_tip_share,f_ticketitem_share_qty,f_ticketitem_real_qty,i_ticketitem_timesheet_id,c_ticketitem_gross_price,c_ticketitem_manual_discounts,c_ticketitem_auto_discounts,i_ti_customer_id,i_ti_void_ticket_id,i_ti_customer_orig_id,dt_ti_ticket_close_time,i_ti_revcenter_id,c_hidden_taxes,i_course_id,original_add_time,s_applicable_ticket_discounts,s_applicable_ticket_taxes,s_special_request,g_ticketitem_id,c_autograt_amount,rv_TicketItem,g_combination_guid) VALUES (579172,'130255',545,'Liftoff','2017-06-12 16:17:03.740',2.00,0.00,NULL,176,74645,NULL,0,NULL,2,1,0,1,0.00,2.00,0,176,NULL,1,1,16010,2.00,0.00,0.00,1369,NULL,1369,'2017-06-12 16:17:12.033',2,0.00,0,'2017-06-12 16:16:20.827',NULL,NULL,NULL,'3FD1C678-DA0E-4E08-A167-AF6639B113C5',0.00,0x000000000105CE0E,'00000000-0000-0000-0000-000000000000');
    INSERT INTO mytable(i_ticket_item_id,i_ticket_id,i_menu_item_id,s_item,dt_when,c_price,c_discount_amount,c_tax_total,i_employee_id,i_cover_id,i_void_item_id,i_held,b_printed,i_split_group,f_split,i_held_for_choice,s_qty,c_ticketitem_choices_amount,c_ticketitem_net_price,f_ticketitem_ticket_discount_factor,i_ticketitem_actual_employee_id,c_ticketitem_tip_share,f_ticketitem_share_qty,f_ticketitem_real_qty,i_ticketitem_timesheet_id,c_ticketitem_gross_price,c_ticketitem_manual_discounts,c_ticketitem_auto_discounts,i_ti_customer_id,i_ti_void_ticket_id,i_ti_customer_orig_id,dt_ti_ticket_close_time,i_ti_revcenter_id,c_hidden_taxes,i_course_id,original_add_time,s_applicable_ticket_discounts,s_applicable_ticket_taxes,s_special_request,g_ticketitem_id,c_autograt_amount,rv_TicketItem,g_combination_guid) VALUES (579173,'130255',465,'Dolce & Gabanna','2017-06-12 16:17:03.753',9.00,0.00,NULL,176,74645,NULL,0,NULL,3,1,0,1,0.00,9.00,0,176,NULL,1,1,16010,9.00,0.00,0.00,1369,NULL,1369,'2017-06-12 16:17:12.033',2,0.00,0,'2017-06-12 16:16:52.343',NULL,NULL,NULL,'646C43AB-865C-47F6-B595-D27A754790B9',0.00,0x000000000105CE0F,'00000000-0000-0000-0000-000000000000');
    INSERT INTO mytable(i_ticket_item_id,i_ticket_id,i_menu_item_id,s_item,dt_when,c_price,c_discount_amount,c_tax_total,i_employee_id,i_cover_id,i_void_item_id,i_held,b_printed,i_split_group,f_split,i_held_for_choice,s_qty,c_ticketitem_choices_amount,c_ticketitem_net_price,f_ticketitem_ticket_discount_factor,i_ticketitem_actual_employee_id,c_ticketitem_tip_share,f_ticketitem_share_qty,f_ticketitem_real_qty,i_ticketitem_timesheet_id,c_ticketitem_gross_price,c_ticketitem_manual_discounts,c_ticketitem_auto_discounts,i_ti_customer_id,i_ti_void_ticket_id,i_ti_customer_orig_id,dt_ti_ticket_close_time,i_ti_revcenter_id,c_hidden_taxes,i_course_id,original_add_time,s_applicable_ticket_discounts,s_applicable_ticket_taxes,s_special_request,g_ticketitem_id,c_autograt_amount,rv_TicketItem,g_combination_guid) VALUES (579174,'130256',505,'Samoas','2017-06-13 09:00:30.330',9.00,0.00,NULL,1,74646,NULL,0,NULL,1,1,0,1,0.00,9.00,0,1,NULL,1,1,16014,9.00,0.00,0.00,3887,NULL,3887,'2017-06-13 09:00:33.923',2,0.00,0,'2017-06-13 09:00:24.520',NULL,NULL,NULL,'0A056508-25BF-4A28-BBDD-400AD5FF74CC',0.00,0x000000000105DCEC,'00000000-0000-0000-0000-000000000000');
    INSERT INTO mytable(i_ticket_item_id,i_ticket_id,i_menu_item_id,s_item,dt_when,c_price,c_discount_amount,c_tax_total,i_employee_id,i_cover_id,i_void_item_id,i_held,b_printed,i_split_group,f_split,i_held_for_choice,s_qty,c_ticketitem_choices_amount,c_ticketitem_net_price,f_ticketitem_ticket_discount_factor,i_ticketitem_actual_employee_id,c_ticketitem_tip_share,f_ticketitem_share_qty,f_ticketitem_real_qty,i_ticketitem_timesheet_id,c_ticketitem_gross_price,c_ticketitem_manual_discounts,c_ticketitem_auto_discounts,i_ti_customer_id,i_ti_void_ticket_id,i_ti_customer_orig_id,dt_ti_ticket_close_time,i_ti_revcenter_id,c_hidden_taxes,i_course_id,original_add_time,s_applicable_ticket_discounts,s_applicable_ticket_taxes,s_special_request,g_ticketitem_id,c_autograt_amount,rv_TicketItem,g_combination_guid) VALUES (579175,'130257',505,'Samoas','2017-06-13 09:00:52.890',9.00,0.00,NULL,1,74647,NULL,0,NULL,1,1,0,1,0.00,9.00,0,1,NULL,1,1,16014,9.00,0.00,0.00,0,NULL,NULL,'2017-06-13 09:00:54.213',2,0.00,0,'2017-06-13 09:00:48.763',NULL,NULL,NULL,'62F4D307-F115-4504-8E9C-6E06E345827F',0.00,0x000000000105DCEB,'00000000-0000-0000-0000-000000000000');
    INSERT INTO mytable(i_ticket_item_id,i_ticket_id,i_menu_item_id,s_item,dt_when,c_price,c_discount_amount,c_tax_total,i_employee_id,i_cover_id,i_void_item_id,i_held,b_printed,i_split_group,f_split,i_held_for_choice,s_qty,c_ticketitem_choices_amount,c_ticketitem_net_price,f_ticketitem_ticket_discount_factor,i_ticketitem_actual_employee_id,c_ticketitem_tip_share,f_ticketitem_share_qty,f_ticketitem_real_qty,i_ticketitem_timesheet_id,c_ticketitem_gross_price,c_ticketitem_manual_discounts,c_ticketitem_auto_discounts,i_ti_customer_id,i_ti_void_ticket_id,i_ti_customer_orig_id,dt_ti_ticket_close_time,i_ti_revcenter_id,c_hidden_taxes,i_course_id,original_add_time,s_applicable_ticket_discounts,s_applicable_ticket_taxes,s_special_request,g_ticketitem_id,c_autograt_amount,rv_TicketItem,g_combination_guid) VALUES (579176,'130258',541,'Orange H3O','2017-06-13 09:37:39.780',2.00,0.00,NULL,1,74648,NULL,0,NULL,1,1,0,1,0.00,2.00,0,1,NULL,1,1,16014,2.00,0.00,0.00,3887,NULL,3887,'2017-06-13 09:37:41.190',2,0.00,0,'2017-06-13 09:37:17.580',NULL,NULL,NULL,'F0CAACA7-D47F-4536-9F4C-6A4FD53F8696',0.00,0x000000000105DCE9,'00000000-0000-0000-0000-000000000000');
    INSERT INTO mytable(i_ticket_item_id,i_ticket_id,i_menu_item_id,s_item,dt_when,c_price,c_discount_amount,c_tax_total,i_employee_id,i_cover_id,i_void_item_id,i_held,b_printed,i_split_group,f_split,i_held_for_choice,s_qty,c_ticketitem_choices_amount,c_ticketitem_net_price,f_ticketitem_ticket_discount_factor,i_ticketitem_actual_employee_id,c_ticketitem_tip_share,f_ticketitem_share_qty,f_ticketitem_real_qty,i_ticketitem_timesheet_id,c_ticketitem_gross_price,c_ticketitem_manual_discounts,c_ticketitem_auto_discounts,i_ti_customer_id,i_ti_void_ticket_id,i_ti_customer_orig_id,dt_ti_ticket_close_time,i_ti_revcenter_id,c_hidden_taxes,i_course_id,original_add_time,s_applicable_ticket_discounts,s_applicable_ticket_taxes,s_special_request,g_ticketitem_id,c_autograt_amount,rv_TicketItem,g_combination_guid) VALUES (579177,'130258',541,'Orange H3O','2017-06-13 09:37:39.787',2.00,0.00,NULL,1,74648,NULL,0,NULL,2,1,0,1,0.00,2.00,0,1,NULL,1,1,16014,2.00,0.00,0.00,3887,NULL,3887,'2017-06-13 09:37:41.190',2,0.00,0,'2017-06-13 09:37:18.153',NULL,NULL,NULL,'DB44E614-1487-4E2C-8787-E9AEAFE9CD1F',0.00,0x000000000105DCEA,'00000000-0000-0000-0000-000000000000');
    INSERT INTO mytable(i_ticket_item_id,i_ticket_id,i_menu_item_id,s_item,dt_when,c_price,c_discount_amount,c_tax_total,i_employee_id,i_cover_id,i_void_item_id,i_held,b_printed,i_split_group,f_split,i_held_for_choice,s_qty,c_ticketitem_choices_amount,c_ticketitem_net_price,f_ticketitem_ticket_discount_factor,i_ticketitem_actual_employee_id,c_ticketitem_tip_share,f_ticketitem_share_qty,f_ticketitem_real_qty,i_ticketitem_timesheet_id,c_ticketitem_gross_price,c_ticketitem_manual_discounts,c_ticketitem_auto_discounts,i_ti_customer_id,i_ti_void_ticket_id,i_ti_customer_orig_id,dt_ti_ticket_close_time,i_ti_revcenter_id,c_hidden_taxes,i_course_id,original_add_time,s_applicable_ticket_discounts,s_applicable_ticket_taxes,s_special_request,g_ticketitem_id,c_autograt_amount,rv_TicketItem,g_combination_guid) VALUES (579178,'130259',541,'Orange H3O','2017-06-13 09:43:55.640',2.00,0.00,NULL,1,74649,NULL,0,NULL,1,1,0,1,0.00,2.00,0,1,NULL,1,1,16014,2.00,0.00,0.00,3887,NULL,3887,'2017-06-13 09:43:57.067',2,0.00,0,'2017-06-13 09:43:41.653',NULL,NULL,NULL,'EFCABCDE-3579-47E1-99B3-6078A192BE2C',0.00,0x000000000105DCE8,'00000000-0000-0000-0000-000000000000');
    INSERT INTO mytable(i_ticket_item_id,i_ticket_id,i_menu_item_id,s_item,dt_when,c_price,c_discount_amount,c_tax_total,i_employee_id,i_cover_id,i_void_item_id,i_held,b_printed,i_split_group,f_split,i_held_for_choice,s_qty,c_ticketitem_choices_amount,c_ticketitem_net_price,f_ticketitem_ticket_discount_factor,i_ticketitem_actual_employee_id,c_ticketitem_tip_share,f_ticketitem_share_qty,f_ticketitem_real_qty,i_ticketitem_timesheet_id,c_ticketitem_gross_price,c_ticketitem_manual_discounts,c_ticketitem_auto_discounts,i_ti_customer_id,i_ti_void_ticket_id,i_ti_customer_orig_id,dt_ti_ticket_close_time,i_ti_revcenter_id,c_hidden_taxes,i_course_id,original_add_time,s_applicable_ticket_discounts,s_applicable_ticket_taxes,s_special_request,g_ticketitem_id,c_autograt_amount,rv_TicketItem,g_combination_guid) VALUES (579179,'130260',438,'Bananas Foster','2017-06-14 08:51:59.920',9.00,0.00,NULL,179,74650,NULL,0,NULL,1,1,0,1,0.00,9.00,0,179,NULL,1,1,16051,9.00,0.00,0.00,0,NULL,NULL,'2017-06-14 08:52:01.790',0,0.00,0,'2017-06-14 08:51:58.370',NULL,NULL,NULL,'8A02A033-D03E-4F87-96F4-67C6E0661837',0.00,0x000000000105E7AC,'00000000-0000-0000-0000-000000000000');
    INSERT INTO mytable(i_ticket_item_id,i_ticket_id,i_menu_item_id,s_item,dt_when,c_price,c_discount_amount,c_tax_total,i_employee_id,i_cover_id,i_void_item_id,i_held,b_printed,i_split_group,f_split,i_held_for_choice,s_qty,c_ticketitem_choices_amount,c_ticketitem_net_price,f_ticketitem_ticket_discount_factor,i_ticketitem_actual_employee_id,c_ticketitem_tip_share,f_ticketitem_share_qty,f_ticketitem_real_qty,i_ticketitem_timesheet_id,c_ticketitem_gross_price,c_ticketitem_manual_discounts,c_ticketitem_auto_discounts,i_ti_customer_id,i_ti_void_ticket_id,i_ti_customer_orig_id,dt_ti_ticket_close_time,i_ti_revcenter_id,c_hidden_taxes,i_course_id,original_add_time,s_applicable_ticket_discounts,s_applicable_ticket_taxes,s_special_request,g_ticketitem_id,c_autograt_amount,rv_TicketItem,g_combination_guid) VALUES (579180,'130260',438,'Bananas Foster','2017-06-14 08:51:59.960',9.00,0.00,NULL,179,74650,NULL,0,NULL,2,1,0,1,0.00,9.00,0,179,NULL,1,1,16051,9.00,0.00,0.00,0,NULL,NULL,'2017-06-14 08:52:01.790',0,0.00,0,'2017-06-14 08:51:58.500',NULL,NULL,NULL,'E41D3E5B-4EAF-4515-BC3F-BCEC4D140FA6',0.00,0x000000000105E7AD,'00000000-0000-0000-0000-000000000000');
    INSERT INTO mytable(i_ticket_item_id,i_ticket_id,i_menu_item_id,s_item,dt_when,c_price,c_discount_amount,c_tax_total,i_employee_id,i_cover_id,i_void_item_id,i_held,b_printed,i_split_group,f_split,i_held_for_choice,s_qty,c_ticketitem_choices_amount,c_ticketitem_net_price,f_ticketitem_ticket_discount_factor,i_ticketitem_actual_employee_id,c_ticketitem_tip_share,f_ticketitem_share_qty,f_ticketitem_real_qty,i_ticketitem_timesheet_id,c_ticketitem_gross_price,c_ticketitem_manual_discounts,c_ticketitem_auto_discounts,i_ti_customer_id,i_ti_void_ticket_id,i_ti_customer_orig_id,dt_ti_ticket_close_time,i_ti_revcenter_id,c_hidden_taxes,i_course_id,original_add_time,s_applicable_ticket_discounts,s_applicable_ticket_taxes,s_special_request,g_ticketitem_id,c_autograt_amount,rv_TicketItem,g_combination_guid) VALUES (579181,'130260',438,'Bananas Foster','2017-06-14 08:51:59.963',9.00,0.00,NULL,179,74650,NULL,0,NULL,3,1,0,1,0.00,9.00,0,179,NULL,1,1,16051,9.00,0.00,0.00,0,NULL,NULL,'2017-06-14 08:52:01.790',0,0.00,0,'2017-06-14 08:51:58.617',NULL,NULL,NULL,'BA616DB3-A481-44D8-BBA6-647DFF56D944',0.00,0x000000000105E7AE,'00000000-0000-0000-0000-000000000000');
    INSERT INTO mytable(i_ticket_item_id,i_ticket_id,i_menu_item_id,s_item,dt_when,c_price,c_discount_amount,c_tax_total,i_employee_id,i_cover_id,i_void_item_id,i_held,b_printed,i_split_group,f_split,i_held_for_choice,s_qty,c_ticketitem_choices_amount,c_ticketitem_net_price,f_ticketitem_ticket_discount_factor,i_ticketitem_actual_employee_id,c_ticketitem_tip_share,f_ticketitem_share_qty,f_ticketitem_real_qty,i_ticketitem_timesheet_id,c_ticketitem_gross_price,c_ticketitem_manual_discounts,c_ticketitem_auto_discounts,i_ti_customer_id,i_ti_void_ticket_id,i_ti_customer_orig_id,dt_ti_ticket_close_time,i_ti_revcenter_id,c_hidden_taxes,i_course_id,original_add_time,s_applicable_ticket_discounts,s_applicable_ticket_taxes,s_special_request,g_ticketitem_id,c_autograt_amount,rv_TicketItem,g_combination_guid) VALUES (579182,'130260',438,'Bananas Foster','2017-06-14 08:51:59.967',9.00,0.00,NULL,179,74650,NULL,0,NULL,4,1,0,1,0.00,9.00,0,179,NULL,1,1,16051,9.00,0.00,0.00,0,NULL,NULL,'2017-06-14 08:52:01.790',0,0.00,0,'2017-06-14 08:51:58.787',NULL,NULL,NULL,'797B0149-C149-4865-A05B-21BCC4017B87',0.00,0x000000000105E7AF,'00000000-0000-0000-0000-000000000000');
    INSERT INTO mytable(i_ticket_item_id,i_ticket_id,i_menu_item_id,s_item,dt_when,c_price,c_discount_amount,c_tax_total,i_employee_id,i_cover_id,i_void_item_id,i_held,b_printed,i_split_group,f_split,i_held_for_choice,s_qty,c_ticketitem_choices_amount,c_ticketitem_net_price,f_ticketitem_ticket_discount_factor,i_ticketitem_actual_employee_id,c_ticketitem_tip_share,f_ticketitem_share_qty,f_ticketitem_real_qty,i_ticketitem_timesheet_id,c_ticketitem_gross_price,c_ticketitem_manual_discounts,c_ticketitem_auto_discounts,i_ti_customer_id,i_ti_void_ticket_id,i_ti_customer_orig_id,dt_ti_ticket_close_time,i_ti_revcenter_id,c_hidden_taxes,i_course_id,original_add_time,s_applicable_ticket_discounts,s_applicable_ticket_taxes,s_special_request,g_ticketitem_id,c_autograt_amount,rv_TicketItem,g_combination_guid) VALUES (579183,'130260',438,'Bananas Foster','2017-06-14 08:51:59.967',9.00,0.00,NULL,179,74650,NULL,0,NULL,5,1,0,1,0.00,9.00,0,179,NULL,1,1,16051,9.00,0.00,0.00,0,NULL,NULL,'2017-06-14 08:52:01.790',0,0.00,0,'2017-06-14 08:51:58.947',NULL,NULL,NULL,'CD9D76EA-41AE-4E89-AEC2-1E6EAFDE539C',0.00,0x000000000105E7B0,'00000000-0000-0000-0000-000000000000');

    CREATE TABLE ChoiceItem(
     i_choice_item_id     INTEGER NOT NULL PRIMARY KEY
    ,i_choice_id      INTEGER NOT NULL
    ,i_ticket_item_id     INTEGER NOT NULL
    ,i_employee_id      INTEGER NOT NULL
    ,dt_when        VARCHAR(23) NOT NULL
    ,s_choice_name      VARCHAR(19) NOT NULL
    ,m_choice_price_mod    NUMERIC(4,2) NOT NULL
    ,m_choiceitem_price    NUMERIC(4,2) NOT NULL
    ,i_choiceitem_timesheet_id  VARCHAR(4)
    ,i_choiceitem_parent_cci_id INTEGER NOT NULL
    ,i_choiceitem_ordinal   BIT NOT NULL
    ,i_choiceitem_cc_id    BIT NOT NULL
    ,dt_added       VARCHAR(23) NOT NULL
    ,m_ci_quantity      NUMERIC(4,2) NOT NULL
    ,m_ci_original_quantity   NUMERIC(4,2) NOT NULL
    ,rv_ChoiceItem      INTEGER NOT NULL
    ,g_ChoiceItem_id     VARCHAR(36) NOT NULL
    ,m_ci_original_share_quantity BIT NOT NULL
    );
    INSERT INTO mytable(i_choice_item_id,i_choice_id,i_ticket_item_id,i_employee_id,dt_when,s_choice_name,m_choice_price_mod,m_choiceitem_price,i_choiceitem_timesheet_id,i_choiceitem_parent_cci_id,i_choiceitem_ordinal,i_choiceitem_cc_id,dt_added,m_ci_quantity,m_ci_original_quantity,rv_ChoiceItem,g_ChoiceItem_id,m_ci_original_share_quantity) VALUES (162929,122,579167,154,'2017-06-12 15:58:53.290','Lemon Tea Hot',0.00,0.00,NULL,369288,1,0,'2017-06-12 15:58:48.943',1.00,1.00,0x000000000105C543,'0925B2E6-20D1-4C41-A0E2-DFFC66F3FB7F',1);
    INSERT INTO mytable(i_choice_item_id,i_choice_id,i_ticket_item_id,i_employee_id,dt_when,s_choice_name,m_choice_price_mod,m_choiceitem_price,i_choiceitem_timesheet_id,i_choiceitem_parent_cci_id,i_choiceitem_ordinal,i_choiceitem_cc_id,dt_added,m_ci_quantity,m_ci_original_quantity,rv_ChoiceItem,g_ChoiceItem_id,m_ci_original_share_quantity) VALUES (162930,119,579167,154,'2017-06-12 15:58:53.290','Cranberry Aloe Shot',0.00,0.00,NULL,369289,1,0,'2017-06-12 15:58:49.800',1.00,1.00,0x000000000105C545,'F815441D-1B71-48B1-8DED-22721A6526E2',1);
    INSERT INTO mytable(i_choice_item_id,i_choice_id,i_ticket_item_id,i_employee_id,dt_when,s_choice_name,m_choice_price_mod,m_choiceitem_price,i_choiceitem_timesheet_id,i_choiceitem_parent_cci_id,i_choiceitem_ordinal,i_choiceitem_cc_id,dt_added,m_ci_quantity,m_ci_original_quantity,rv_ChoiceItem,g_ChoiceItem_id,m_ci_original_share_quantity) VALUES (162931,145,579168,154,'2017-06-12 15:58:53.307','Pomegrante Liftoff',0.00,0.00,NULL,369290,1,0,'2017-06-12 15:58:52.223',1.00,1.00,0x000000000105C54B,'7057F65F-5CEA-4D9B-A80C-0C51F16104D9',1);
    INSERT INTO mytable(i_choice_item_id,i_choice_id,i_ticket_item_id,i_employee_id,dt_when,s_choice_name,m_choice_price_mod,m_choiceitem_price,i_choiceitem_timesheet_id,i_choiceitem_parent_cci_id,i_choiceitem_ordinal,i_choiceitem_cc_id,dt_added,m_ci_quantity,m_ci_original_quantity,rv_ChoiceItem,g_ChoiceItem_id,m_ci_original_share_quantity) VALUES (162932,130,579169,133,'2017-06-12 16:03:22.950','Lemon Tea Cold',0.00,0.00,NULL,369291,1,0,'2017-06-12 16:03:21.690',1.00,1.00,0x000000000105C602,'CAD1BC6B-D22D-4CAF-9488-BD64A1B506C2',1);
    INSERT INTO mytable(i_choice_item_id,i_choice_id,i_ticket_item_id,i_employee_id,dt_when,s_choice_name,m_choice_price_mod,m_choiceitem_price,i_choiceitem_timesheet_id,i_choiceitem_parent_cci_id,i_choiceitem_ordinal,i_choiceitem_cc_id,dt_added,m_ci_quantity,m_ci_original_quantity,rv_ChoiceItem,g_ChoiceItem_id,m_ci_original_share_quantity) VALUES (162933,120,579169,133,'2017-06-12 16:03:22.953','Mango Aloe Shot',0.00,0.00,NULL,369292,1,0,'2017-06-12 16:03:22.190',1.00,1.00,0x000000000105C604,'AEB453D3-4B14-44EB-B2EE-9334AA828CE4',1);
    INSERT INTO mytable(i_choice_item_id,i_choice_id,i_ticket_item_id,i_employee_id,dt_when,s_choice_name,m_choice_price_mod,m_choiceitem_price,i_choiceitem_timesheet_id,i_choiceitem_parent_cci_id,i_choiceitem_ordinal,i_choiceitem_cc_id,dt_added,m_ci_quantity,m_ci_original_quantity,rv_ChoiceItem,g_ChoiceItem_id,m_ci_original_share_quantity) VALUES (162934,130,579170,176,'2017-06-12 16:13:06.223','Lemon Tea Cold',0.00,0.00,NULL,369296,1,0,'2017-06-12 16:13:04.827',1.00,1.00,0x000000000105C7AF,'2EB08907-3314-4EF2-992B-5B1E66DDF587',1);
    INSERT INTO mytable(i_choice_item_id,i_choice_id,i_ticket_item_id,i_employee_id,dt_when,s_choice_name,m_choice_price_mod,m_choiceitem_price,i_choiceitem_timesheet_id,i_choiceitem_parent_cci_id,i_choiceitem_ordinal,i_choiceitem_cc_id,dt_added,m_ci_quantity,m_ci_original_quantity,rv_ChoiceItem,g_ChoiceItem_id,m_ci_original_share_quantity) VALUES (162935,120,579170,176,'2017-06-12 16:13:06.227','Mango Aloe Shot',0.00,0.00,NULL,369297,1,0,'2017-06-12 16:13:05.360',1.00,1.00,0x000000000105C7B1,'66C93094-4FC1-4EC9-B302-0421B7504C51',1);
    INSERT INTO mytable(i_choice_item_id,i_choice_id,i_ticket_item_id,i_employee_id,dt_when,s_choice_name,m_choice_price_mod,m_choiceitem_price,i_choiceitem_timesheet_id,i_choiceitem_parent_cci_id,i_choiceitem_ordinal,i_choiceitem_cc_id,dt_added,m_ci_quantity,m_ci_original_quantity,rv_ChoiceItem,g_ChoiceItem_id,m_ci_original_share_quantity) VALUES (162936,130,579171,176,'2017-06-12 16:17:03.710','Lemon Tea Cold',0.00,0.00,NULL,369301,1,0,'2017-06-12 16:16:10.530',1.00,1.00,0x000000000105C873,'DEF135BE-B548-447D-8C11-78435A6C85C7',1);
    INSERT INTO mytable(i_choice_item_id,i_choice_id,i_ticket_item_id,i_employee_id,dt_when,s_choice_name,m_choice_price_mod,m_choiceitem_price,i_choiceitem_timesheet_id,i_choiceitem_parent_cci_id,i_choiceitem_ordinal,i_choiceitem_cc_id,dt_added,m_ci_quantity,m_ci_original_quantity,rv_ChoiceItem,g_ChoiceItem_id,m_ci_original_share_quantity) VALUES (162937,119,579171,176,'2017-06-12 16:17:03.710','Cranberry Aloe Shot',0.00,0.00,NULL,369302,1,0,'2017-06-12 16:16:11.420',1.00,1.00,0x000000000105C875,'A80E5B07-F928-4CCA-BEA4-D857C6A2B135',1);
    INSERT INTO mytable(i_choice_item_id,i_choice_id,i_ticket_item_id,i_employee_id,dt_when,s_choice_name,m_choice_price_mod,m_choiceitem_price,i_choiceitem_timesheet_id,i_choiceitem_parent_cci_id,i_choiceitem_ordinal,i_choiceitem_cc_id,dt_added,m_ci_quantity,m_ci_original_quantity,rv_ChoiceItem,g_ChoiceItem_id,m_ci_original_share_quantity) VALUES (162938,145,579172,176,'2017-06-12 16:17:03.743','Pomegrante Liftoff',0.00,0.00,NULL,369306,1,0,'2017-06-12 16:16:22.403',1.00,1.00,0x000000000105C87E,'7E268514-AE20-4FA2-8ADE-C5C5867CC22E',1);
    INSERT INTO mytable(i_choice_item_id,i_choice_id,i_ticket_item_id,i_employee_id,dt_when,s_choice_name,m_choice_price_mod,m_choiceitem_price,i_choiceitem_timesheet_id,i_choiceitem_parent_cci_id,i_choiceitem_ordinal,i_choiceitem_cc_id,dt_added,m_ci_quantity,m_ci_original_quantity,rv_ChoiceItem,g_ChoiceItem_id,m_ci_original_share_quantity) VALUES (162939,125,579174,1,'2017-06-13 09:00:30.350','Cinnamon Tea Hot',0.00,0.00,NULL,369312,1,0,'2017-06-13 09:00:26.283',1.00,1.00,0x000000000105D798,'3BB416AC-7549-4606-BA4A-53BD3D32096C',1);
    INSERT INTO mytable(i_choice_item_id,i_choice_id,i_ticket_item_id,i_employee_id,dt_when,s_choice_name,m_choice_price_mod,m_choiceitem_price,i_choiceitem_timesheet_id,i_choiceitem_parent_cci_id,i_choiceitem_ordinal,i_choiceitem_cc_id,dt_added,m_ci_quantity,m_ci_original_quantity,rv_ChoiceItem,g_ChoiceItem_id,m_ci_original_share_quantity) VALUES (162940,118,579174,1,'2017-06-13 09:00:30.353','Whey/Casein Protein',0.00,0.00,NULL,369314,1,0,'2017-06-13 09:00:27.713',1.00,1.00,0x000000000105D79B,'9EF1D9AC-33FC-499A-AA8E-47169C703C5B',1);
    INSERT INTO mytable(i_choice_item_id,i_choice_id,i_ticket_item_id,i_employee_id,dt_when,s_choice_name,m_choice_price_mod,m_choiceitem_price,i_choiceitem_timesheet_id,i_choiceitem_parent_cci_id,i_choiceitem_ordinal,i_choiceitem_cc_id,dt_added,m_ci_quantity,m_ci_original_quantity,rv_ChoiceItem,g_ChoiceItem_id,m_ci_original_share_quantity) VALUES (162941,133,579175,1,'2017-06-13 09:00:52.890','Cinnamon Tea Cold',0.00,0.00,NULL,369317,1,0,'2017-06-13 09:00:50.863',1.00,1.00,0x000000000105D824,'EA7D4528-BACA-4E4F-B757-3F016C724174',1);
    INSERT INTO mytable(i_choice_item_id,i_choice_id,i_ticket_item_id,i_employee_id,dt_when,s_choice_name,m_choice_price_mod,m_choiceitem_price,i_choiceitem_timesheet_id,i_choiceitem_parent_cci_id,i_choiceitem_ordinal,i_choiceitem_cc_id,dt_added,m_ci_quantity,m_ci_original_quantity,rv_ChoiceItem,g_ChoiceItem_id,m_ci_original_share_quantity) VALUES (162942,119,579175,1,'2017-06-13 09:00:52.893','Cranberry Aloe Shot',0.00,0.00,NULL,369318,1,0,'2017-06-13 09:00:51.600',1.00,1.00,0x000000000105D826,'BF1BD6E0-7F21-4FD3-9957-B1B3D7B108C6',1);
    INSERT INTO mytable(i_choice_item_id,i_choice_id,i_ticket_item_id,i_employee_id,dt_when,s_choice_name,m_choice_price_mod,m_choiceitem_price,i_choiceitem_timesheet_id,i_choiceitem_parent_cci_id,i_choiceitem_ordinal,i_choiceitem_cc_id,dt_added,m_ci_quantity,m_ci_original_quantity,rv_ChoiceItem,g_ChoiceItem_id,m_ci_original_share_quantity) VALUES (162943,133,579178,1,'2017-06-13 09:43:55.643','Cinnamon Tea Cold',0.00,0.00,NULL,369322,1,0,'2017-06-13 09:43:42.727',1.00,1.00,0x000000000105DBFA,'4657E85B-4588-4F79-B77D-E38089AFE9E6',1);

    CREATE TABLE Customers(
     i_employee_id       INTEGER NOT NULL PRIMARY KEY
    ,s_name         VARCHAR2(17) NOT NULL
    ,s_login         INTEGER NOT NULL
    ,b_active         BIT NOT NULL
    ,b_admin         BIT NOT NULL
    ,b_is_clocked_in      BIT NOT NULL
    ,b_is_logged_in       BIT NOT NULL
    ,dt_clock_in        VARCHAR2(23)
    ,dt_expected_clock_out    VARCHAR(4)
    ,i_employ_id        BIT NOT NULL
    ,s_phone1         VARCHAR(30)
    ,s_phone2         VARCHAR(30)
    ,s_emerg_phone       VARCHAR(30)
    ,s_SSN          VARCHAR(30)
    ,dt_hire         VARCHAR(23) NOT NULL
    ,dt_term         VARCHAR(23) NOT NULL
    ,dt_review        VARCHAR(23) NOT NULL
    ,dt_birth         VARCHAR(23) NOT NULL
    ,s_first         VARCHAR(30)
    ,s_middle         VARCHAR(30)
    ,s_last         VARCHAR(30)
    ,s_street         VARCHAR(30)
    ,s_street2        VARCHAR(30)
    ,s_city         VARCHAR(30)
    ,s_state         VARCHAR(30)
    ,s_postal         VARCHAR(30)
    ,s_email         VARCHAR(30)
    ,s_employee_cardswipe     VARCHAR(30)
    ,i_employee_ordinal     INTEGER NOT NULL
    ,i_employees_current_timesheet_id INTEGER NOT NULL
    ,i_employee_ticketlist_schema  INTEGER NOT NULL
    ,dt_employee_liquor_card_exp_date VARCHAR(23) NOT NULL
    ,dt_employee_health_card_exp_date VARCHAR(23) NOT NULL
    ,s_employee_payroll_id    VARCHAR(30)
    ,s_password_hash      VARCHAR(4)
    ,s_password_salt      VARCHAR(4)
    ,dt_password_changed     VARCHAR(4)
    ,i_authentication_failures   VARCHAR(4)
    ,dt_lockout        VARCHAR(4)
    ,i_security_template_id    INTEGER NOT NULL
    ,rv_Employees       INTEGER NOT NULL
    ,g_Employees_id       VARCHAR(36) NOT NULL
    ,i_external_id       VARCHAR(4)
    );
    INSERT INTO mytable(i_employee_id,s_name,s_login,b_active,b_admin,b_is_clocked_in,b_is_logged_in,dt_clock_in,dt_expected_clock_out,i_employ_id,s_phone1,s_phone2,s_emerg_phone,s_SSN,dt_hire,dt_term,dt_review,dt_birth,s_first,s_middle,s_last,s_street,s_street2,s_city,s_state,s_postal,s_email,s_employee_cardswipe,i_employee_ordinal,i_employees_current_timesheet_id,i_employee_ticketlist_schema,dt_employee_liquor_card_exp_date,dt_employee_health_card_exp_date,s_employee_payroll_id,s_password_hash,s_password_salt,dt_password_changed,i_authentication_failures,dt_lockout,i_security_template_id,rv_Employees,g_Employees_id,i_external_id) VALUES (132,'Hannah Snow',1992,1,0,1,0,'2016-11-16 13:30:30.727',NULL,0,NULL,NULL,NULL,NULL,'1753-01-01 00:00:00.000','1753-01-01 00:00:00.000','1753-01-01 00:00:00.000','1753-01-01 00:00:00.000',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8,16035,3358,'1753-01-01 00:00:00.000','1753-01-01 00:00:00.000',NULL,NULL,NULL,NULL,NULL,NULL,3,0x000000000105E659,'7EB4D5C4-2069-4698-AFF7-D9A88C0B6292',NULL);
    INSERT INTO mytable(i_employee_id,s_name,s_login,b_active,b_admin,b_is_clocked_in,b_is_logged_in,dt_clock_in,dt_expected_clock_out,i_employ_id,s_phone1,s_phone2,s_emerg_phone,s_SSN,dt_hire,dt_term,dt_review,dt_birth,s_first,s_middle,s_last,s_street,s_street2,s_city,s_state,s_postal,s_email,s_employee_cardswipe,i_employee_ordinal,i_employees_current_timesheet_id,i_employee_ticketlist_schema,dt_employee_liquor_card_exp_date,dt_employee_health_card_exp_date,s_employee_payroll_id,s_password_hash,s_password_salt,dt_password_changed,i_authentication_failures,dt_lockout,i_security_template_id,rv_Employees,g_Employees_id,i_external_id) VALUES (133,'Mackenzie Reed',1998,1,0,0,0,NULL,NULL,0,NULL,NULL,NULL,NULL,'1753-01-01 00:00:00.000','1753-01-01 00:00:00.000','1753-01-01 00:00:00.000','1753-01-01 00:00:00.000',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13,16006,16966,'1753-01-01 00:00:00.000','1753-01-01 00:00:00.000',NULL,NULL,NULL,NULL,NULL,NULL,4,0x000000000105E65E,'97434887-3118-4609-8D19-1645192BE838',NULL);
    INSERT INTO mytable(i_employee_id,s_name,s_login,b_active,b_admin,b_is_clocked_in,b_is_logged_in,dt_clock_in,dt_expected_clock_out,i_employ_id,s_phone1,s_phone2,s_emerg_phone,s_SSN,dt_hire,dt_term,dt_review,dt_birth,s_first,s_middle,s_last,s_street,s_street2,s_city,s_state,s_postal,s_email,s_employee_cardswipe,i_employee_ordinal,i_employees_current_timesheet_id,i_employee_ticketlist_schema,dt_employee_liquor_card_exp_date,dt_employee_health_card_exp_date,s_employee_payroll_id,s_password_hash,s_password_salt,dt_password_changed,i_authentication_failures,dt_lockout,i_security_template_id,rv_Employees,g_Employees_id,i_external_id) VALUES (147,'Erica Archambault',0702,1,0,1,0,'2017-04-18 16:18:14.447',NULL,0,NULL,NULL,NULL,NULL,'1753-01-01 00:00:00.000','1753-01-01 00:00:00.000','1753-01-01 00:00:00.000','1753-01-01 00:00:00.000',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7,16043,24354,'1753-01-01 00:00:00.000','1753-01-01 00:00:00.000',NULL,NULL,NULL,NULL,NULL,NULL,3,0x000000000105E658,'10207DA7-A24E-4D33-AC17-74C3FD8E2B6F',NULL);
    INSERT INTO mytable(i_employee_id,s_name,s_login,b_active,b_admin,b_is_clocked_in,b_is_logged_in,dt_clock_in,dt_expected_clock_out,i_employ_id,s_phone1,s_phone2,s_emerg_phone,s_SSN,dt_hire,dt_term,dt_review,dt_birth,s_first,s_middle,s_last,s_street,s_street2,s_city,s_state,s_postal,s_email,s_employee_cardswipe,i_employee_ordinal,i_employees_current_timesheet_id,i_employee_ticketlist_schema,dt_employee_liquor_card_exp_date,dt_employee_health_card_exp_date,s_employee_payroll_id,s_password_hash,s_password_salt,dt_password_changed,i_authentication_failures,dt_lockout,i_security_template_id,rv_Employees,g_Employees_id,i_external_id) VALUES (151,'Annie Heffernan',3396,1,0,0,0,NULL,NULL,0,NULL,NULL,NULL,NULL,'1753-01-01 00:00:00.000','1753-01-01 00:00:00.000','1753-01-01 00:00:00.000','1753-01-01 00:00:00.000',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,4,15721,9402,'1753-01-01 00:00:00.000','1753-01-01 00:00:00.000',NULL,NULL,NULL,NULL,NULL,NULL,3,0x000000000105E655,'2C2D9338-6F7A-4C67-8E67-D88C2DFCDE3D',NULL);
    INSERT INTO mytable(i_employee_id,s_name,s_login,b_active,b_admin,b_is_clocked_in,b_is_logged_in,dt_clock_in,dt_expected_clock_out,i_employ_id,s_phone1,s_phone2,s_emerg_phone,s_SSN,dt_hire,dt_term,dt_review,dt_birth,s_first,s_middle,s_last,s_street,s_street2,s_city,s_state,s_postal,s_email,s_employee_cardswipe,i_employee_ordinal,i_employees_current_timesheet_id,i_employee_ticketlist_schema,dt_employee_liquor_card_exp_date,dt_employee_health_card_exp_date,s_employee_payroll_id,s_password_hash,s_password_salt,dt_password_changed,i_authentication_failures,dt_lockout,i_security_template_id,rv_Employees,g_Employees_id,i_external_id) VALUES (154,'Mat Moreira',7298,1,0,0,0,NULL,NULL,0,NULL,NULL,NULL,NULL,'1753-01-01 00:00:00.000','1753-01-01 00:00:00.000','1753-01-01 00:00:00.000','1753-01-01 00:00:00.000',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16,16009,15712,'1753-01-01 00:00:00.000','1753-01-01 00:00:00.000',NULL,NULL,NULL,NULL,NULL,NULL,3,0x000000000105E661,'4BD64193-EB71-4617-A001-029F95B40D8D',NULL);
    INSERT INTO mytable(i_employee_id,s_name,s_login,b_active,b_admin,b_is_clocked_in,b_is_logged_in,dt_clock_in,dt_expected_clock_out,i_employ_id,s_phone1,s_phone2,s_emerg_phone,s_SSN,dt_hire,dt_term,dt_review,dt_birth,s_first,s_middle,s_last,s_street,s_street2,s_city,s_state,s_postal,s_email,s_employee_cardswipe,i_employee_ordinal,i_employees_current_timesheet_id,i_employee_ticketlist_schema,dt_employee_liquor_card_exp_date,dt_employee_health_card_exp_date,s_employee_payroll_id,s_password_hash,s_password_salt,dt_password_changed,i_authentication_failures,dt_lockout,i_security_template_id,rv_Employees,g_Employees_id,i_external_id) VALUES (155,'Whitney Testorf',1203,1,0,0,0,NULL,NULL,0,NULL,NULL,NULL,NULL,'1753-01-01 00:00:00.000','1753-01-01 00:00:00.000','1753-01-01 00:00:00.000','1753-01-01 00:00:00.000',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,19,15984,6251,'1753-01-01 00:00:00.000','1753-01-01 00:00:00.000',NULL,NULL,NULL,NULL,NULL,NULL,3,0x000000000105E664,'755E218B-DFCD-456A-A9F0-D138B1FF9FE9',NULL);
    INSERT INTO mytable(i_employee_id,s_name,s_login,b_active,b_admin,b_is_clocked_in,b_is_logged_in,dt_clock_in,dt_expected_clock_out,i_employ_id,s_phone1,s_phone2,s_emerg_phone,s_SSN,dt_hire,dt_term,dt_review,dt_birth,s_first,s_middle,s_last,s_street,s_street2,s_city,s_state,s_postal,s_email,s_employee_cardswipe,i_employee_ordinal,i_employees_current_timesheet_id,i_employee_ticketlist_schema,dt_employee_liquor_card_exp_date,dt_employee_health_card_exp_date,s_employee_payroll_id,s_password_hash,s_password_salt,dt_password_changed,i_authentication_failures,dt_lockout,i_security_template_id,rv_Employees,g_Employees_id,i_external_id) VALUES (168,'Brianna Wilcox',9739,1,0,1,0,'2017-06-11 07:58:37.960',NULL,0,NULL,NULL,NULL,NULL,'1753-01-01 00:00:00.000','1753-01-01 00:00:00.000','1753-01-01 00:00:00.000','1753-01-01 00:00:00.000',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,5,16049,2447,'1753-01-01 00:00:00.000','1753-01-01 00:00:00.000',NULL,NULL,NULL,NULL,NULL,NULL,3,0x000000000105E656,'B70F711A-8FC0-4561-BD0A-A7A229117DA9',NULL);

    CREATE TABLE Employees(
     i_employee_id       INTEGER NOT NULL PRIMARY KEY
    ,s_name         VARCHAR2(17) NOT NULL
    ,s_login         INTEGER NOT NULL
    ,b_active         BIT NOT NULL
    ,b_admin         BIT NOT NULL
    ,b_is_clocked_in      BIT NOT NULL
    ,b_is_logged_in       BIT NOT NULL
    ,dt_clock_in        VARCHAR2(23)
    ,dt_expected_clock_out    VARCHAR(4)
    ,i_employ_id        BIT NOT NULL
    ,s_phone1         VARCHAR(30)
    ,s_phone2         VARCHAR(30)
    ,s_emerg_phone       VARCHAR(30)
    ,s_SSN          VARCHAR(30)
    ,dt_hire         VARCHAR(23) NOT NULL
    ,dt_term         VARCHAR(23) NOT NULL
    ,dt_review        VARCHAR(23) NOT NULL
    ,dt_birth         VARCHAR(23) NOT NULL
    ,s_first         VARCHAR(30)
    ,s_middle         VARCHAR(30)
    ,s_last         VARCHAR(30)
    ,s_street         VARCHAR(30)
    ,s_street2        VARCHAR(30)
    ,s_city         VARCHAR(30)
    ,s_state         VARCHAR(30)
    ,s_postal         VARCHAR(30)
    ,s_email         VARCHAR(30)
    ,s_employee_cardswipe     VARCHAR(30)
    ,i_employee_ordinal     INTEGER NOT NULL
    ,i_employees_current_timesheet_id INTEGER NOT NULL
    ,i_employee_ticketlist_schema  INTEGER NOT NULL
    ,dt_employee_liquor_card_exp_date VARCHAR(23) NOT NULL
    ,dt_employee_health_card_exp_date VARCHAR(23) NOT NULL
    ,s_employee_payroll_id    VARCHAR(30)
    ,s_password_hash      VARCHAR(4)
    ,s_password_salt      VARCHAR(4)
    ,dt_password_changed     VARCHAR(4)
    ,i_authentication_failures   VARCHAR(4)
    ,dt_lockout        VARCHAR(4)
    ,i_security_template_id    INTEGER NOT NULL
    ,rv_Employees       INTEGER NOT NULL
    ,g_Employees_id       VARCHAR(36) NOT NULL
    ,i_external_id       VARCHAR(4)
    );
    INSERT INTO mytable(i_employee_id,s_name,s_login,b_active,b_admin,b_is_clocked_in,b_is_logged_in,dt_clock_in,dt_expected_clock_out,i_employ_id,s_phone1,s_phone2,s_emerg_phone,s_SSN,dt_hire,dt_term,dt_review,dt_birth,s_first,s_middle,s_last,s_street,s_street2,s_city,s_state,s_postal,s_email,s_employee_cardswipe,i_employee_ordinal,i_employees_current_timesheet_id,i_employee_ticketlist_schema,dt_employee_liquor_card_exp_date,dt_employee_health_card_exp_date,s_employee_payroll_id,s_password_hash,s_password_salt,dt_password_changed,i_authentication_failures,dt_lockout,i_security_template_id,rv_Employees,g_Employees_id,i_external_id) VALUES (132,'Hannah Snow',1992,1,0,1,0,'2016-11-16 13:30:30.727',NULL,0,NULL,NULL,NULL,NULL,'1753-01-01 00:00:00.000','1753-01-01 00:00:00.000','1753-01-01 00:00:00.000','1753-01-01 00:00:00.000',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8,16035,3358,'1753-01-01 00:00:00.000','1753-01-01 00:00:00.000',NULL,NULL,NULL,NULL,NULL,NULL,3,0x000000000105E659,'7EB4D5C4-2069-4698-AFF7-D9A88C0B6292',NULL);
    INSERT INTO mytable(i_employee_id,s_name,s_login,b_active,b_admin,b_is_clocked_in,b_is_logged_in,dt_clock_in,dt_expected_clock_out,i_employ_id,s_phone1,s_phone2,s_emerg_phone,s_SSN,dt_hire,dt_term,dt_review,dt_birth,s_first,s_middle,s_last,s_street,s_street2,s_city,s_state,s_postal,s_email,s_employee_cardswipe,i_employee_ordinal,i_employees_current_timesheet_id,i_employee_ticketlist_schema,dt_employee_liquor_card_exp_date,dt_employee_health_card_exp_date,s_employee_payroll_id,s_password_hash,s_password_salt,dt_password_changed,i_authentication_failures,dt_lockout,i_security_template_id,rv_Employees,g_Employees_id,i_external_id) VALUES (133,'Mackenzie Reed',1998,1,0,0,0,NULL,NULL,0,NULL,NULL,NULL,NULL,'1753-01-01 00:00:00.000','1753-01-01 00:00:00.000','1753-01-01 00:00:00.000','1753-01-01 00:00:00.000',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13,16006,16966,'1753-01-01 00:00:00.000','1753-01-01 00:00:00.000',NULL,NULL,NULL,NULL,NULL,NULL,4,0x000000000105E65E,'97434887-3118-4609-8D19-1645192BE838',NULL);
    INSERT INTO mytable(i_employee_id,s_name,s_login,b_active,b_admin,b_is_clocked_in,b_is_logged_in,dt_clock_in,dt_expected_clock_out,i_employ_id,s_phone1,s_phone2,s_emerg_phone,s_SSN,dt_hire,dt_term,dt_review,dt_birth,s_first,s_middle,s_last,s_street,s_street2,s_city,s_state,s_postal,s_email,s_employee_cardswipe,i_employee_ordinal,i_employees_current_timesheet_id,i_employee_ticketlist_schema,dt_employee_liquor_card_exp_date,dt_employee_health_card_exp_date,s_employee_payroll_id,s_password_hash,s_password_salt,dt_password_changed,i_authentication_failures,dt_lockout,i_security_template_id,rv_Employees,g_Employees_id,i_external_id) VALUES (147,'Erica Archambault',0702,1,0,1,0,'2017-04-18 16:18:14.447',NULL,0,NULL,NULL,NULL,NULL,'1753-01-01 00:00:00.000','1753-01-01 00:00:00.000','1753-01-01 00:00:00.000','1753-01-01 00:00:00.000',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7,16043,24354,'1753-01-01 00:00:00.000','1753-01-01 00:00:00.000',NULL,NULL,NULL,NULL,NULL,NULL,3,0x000000000105E658,'10207DA7-A24E-4D33-AC17-74C3FD8E2B6F',NULL);
    INSERT INTO mytable(i_employee_id,s_name,s_login,b_active,b_admin,b_is_clocked_in,b_is_logged_in,dt_clock_in,dt_expected_clock_out,i_employ_id,s_phone1,s_phone2,s_emerg_phone,s_SSN,dt_hire,dt_term,dt_review,dt_birth,s_first,s_middle,s_last,s_street,s_street2,s_city,s_state,s_postal,s_email,s_employee_cardswipe,i_employee_ordinal,i_employees_current_timesheet_id,i_employee_ticketlist_schema,dt_employee_liquor_card_exp_date,dt_employee_health_card_exp_date,s_employee_payroll_id,s_password_hash,s_password_salt,dt_password_changed,i_authentication_failures,dt_lockout,i_security_template_id,rv_Employees,g_Employees_id,i_external_id) VALUES (151,'Annie Heffernan',3396,1,0,0,0,NULL,NULL,0,NULL,NULL,NULL,NULL,'1753-01-01 00:00:00.000','1753-01-01 00:00:00.000','1753-01-01 00:00:00.000','1753-01-01 00:00:00.000',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,4,15721,9402,'1753-01-01 00:00:00.000','1753-01-01 00:00:00.000',NULL,NULL,NULL,NULL,NULL,NULL,3,0x000000000105E655,'2C2D9338-6F7A-4C67-8E67-D88C2DFCDE3D',NULL);
    INSERT INTO mytable(i_employee_id,s_name,s_login,b_active,b_admin,b_is_clocked_in,b_is_logged_in,dt_clock_in,dt_expected_clock_out,i_employ_id,s_phone1,s_phone2,s_emerg_phone,s_SSN,dt_hire,dt_term,dt_review,dt_birth,s_first,s_middle,s_last,s_street,s_street2,s_city,s_state,s_postal,s_email,s_employee_cardswipe,i_employee_ordinal,i_employees_current_timesheet_id,i_employee_ticketlist_schema,dt_employee_liquor_card_exp_date,dt_employee_health_card_exp_date,s_employee_payroll_id,s_password_hash,s_password_salt,dt_password_changed,i_authentication_failures,dt_lockout,i_security_template_id,rv_Employees,g_Employees_id,i_external_id) VALUES (154,'Mat Moreira',7298,1,0,0,0,NULL,NULL,0,NULL,NULL,NULL,NULL,'1753-01-01 00:00:00.000','1753-01-01 00:00:00.000','1753-01-01 00:00:00.000','1753-01-01 00:00:00.000',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16,16009,15712,'1753-01-01 00:00:00.000','1753-01-01 00:00:00.000',NULL,NULL,NULL,NULL,NULL,NULL,3,0x000000000105E661,'4BD64193-EB71-4617-A001-029F95B40D8D',NULL);
    INSERT INTO mytable(i_employee_id,s_name,s_login,b_active,b_admin,b_is_clocked_in,b_is_logged_in,dt_clock_in,dt_expected_clock_out,i_employ_id,s_phone1,s_phone2,s_emerg_phone,s_SSN,dt_hire,dt_term,dt_review,dt_birth,s_first,s_middle,s_last,s_street,s_street2,s_city,s_state,s_postal,s_email,s_employee_cardswipe,i_employee_ordinal,i_employees_current_timesheet_id,i_employee_ticketlist_schema,dt_employee_liquor_card_exp_date,dt_employee_health_card_exp_date,s_employee_payroll_id,s_password_hash,s_password_salt,dt_password_changed,i_authentication_failures,dt_lockout,i_security_template_id,rv_Employees,g_Employees_id,i_external_id) VALUES (155,'Whitney Testorf',1203,1,0,0,0,NULL,NULL,0,NULL,NULL,NULL,NULL,'1753-01-01 00:00:00.000','1753-01-01 00:00:00.000','1753-01-01 00:00:00.000','1753-01-01 00:00:00.000',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,19,15984,6251,'1753-01-01 00:00:00.000','1753-01-01 00:00:00.000',NULL,NULL,NULL,NULL,NULL,NULL,3,0x000000000105E664,'755E218B-DFCD-456A-A9F0-D138B1FF9FE9',NULL);
    INSERT INTO mytable(i_employee_id,s_name,s_login,b_active,b_admin,b_is_clocked_in,b_is_logged_in,dt_clock_in,dt_expected_clock_out,i_employ_id,s_phone1,s_phone2,s_emerg_phone,s_SSN,dt_hire,dt_term,dt_review,dt_birth,s_first,s_middle,s_last,s_street,s_street2,s_city,s_state,s_postal,s_email,s_employee_cardswipe,i_employee_ordinal,i_employees_current_timesheet_id,i_employee_ticketlist_schema,dt_employee_liquor_card_exp_date,dt_employee_health_card_exp_date,s_employee_payroll_id,s_password_hash,s_password_salt,dt_password_changed,i_authentication_failures,dt_lockout,i_security_template_id,rv_Employees,g_Employees_id,i_external_id) VALUES (168,'Brianna Wilcox',9739,1,0,1,0,'2017-06-11 07:58:37.960',NULL,0,NULL,NULL,NULL,NULL,'1753-01-01 00:00:00.000','1753-01-01 00:00:00.000','1753-01-01 00:00:00.000','1753-01-01 00:00:00.000',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,5,16049,2447,'1753-01-01 00:00:00.000','1753-01-01 00:00:00.000',NULL,NULL,NULL,NULL,NULL,NULL,3,0x000000000105E656,'B70F711A-8FC0-4561-BD0A-A7A229117DA9',NULL);

  • My current query:
    SELECT
    Ticket.i_ticket_id as Ticket#,
    TicketItem.s_item as Menu_Item,
    ChoiceItem.s_choice_name as Choice_Added,
    TicketItem.s_qty as Quanity_Sold,
    ChoiceItem.i_ticket_item_id as Ticket_Item_ID,
    Customers.cust_fullname as Customer,
    Employees.s_name as Employee,
    ROW_NUMBER() OVER (PARTITION BY Ticket.i_ticket_id , TicketItem.s_item , TicketItem.s_qty , ChoiceItem.i_ticket_item_id , Customers.cust_fullname ORDER BY Employees.s_name) AS Row#
    FROM Ticket
    INNER JOIN TicketItem on Ticket.i_ticket_id = TicketItem.i_ticket_id
    INNER JOIN Customers on Ticket.i_customer_id = Customers.cust_id
    INNER JOIN Employees on Employees.i_employee_id = Ticket.i_user_id
    INNER JOIN ChoiceItem on ChoiceItem.i_ticket_item_id = TicketItem.i_ticket_item_id
    WHERE Ticket.i_void_ticket_id is NULL and Ticket.b_closed = 1 and dt_close_time between '2017-06-04 04:11:10.780' and '2017-06-04 23:11:10.780'
    ORDER BY Employees.s_name ASC

    Which gives me this output:

    Ticket#    Menu_Item    Choice_Added    Quanity_Sold    Ticket_Item_ID    Customer    Employee    Row#
    128999    PL Wedding Cake    Lemon Tea Cold    1       576962    Ferreira Amber    Brianna Wilcox    1
    128999    PL Wedding Cake    Cranberry Aloe Shot    1       576962    Ferreira Amber    Brianna Wilcox    2
    128999    Liftoff    Pomegrante Liftoff    1       576963    Ferreira Amber    Brianna Wilcox    1
    129000    Chocolate Fudge    Lemon Tea Cold    1       576964    Owejan Jayda    Brianna Wilcox    1
    129000    Chocolate Fudge    Cranberry Aloe Shot    1       576964    Owejan Jayda    Brianna Wilcox    2
    129000    Liftoff    Pomegrante Liftoff    1       576965    Owejan Jayda    Brianna Wilcox    1
    129001    Mint Oreo    Peach Tea Cold    1       576966    Wilcox Brianna    Brianna Wilcox    1
    129001    Mint Oreo    Mandarin Aloe Shot    1       576966    Wilcox Brianna    Brianna Wilcox    2
    129002    Wedding Cake    Original Tea Cold    1       576969    jorge toni    Brianna Wilcox    1
    129002    Wedding Cake    Mango Aloe Shot    1       576969    jorge toni    Brianna Wilcox    2
    129002    Liftoff    Orange Liftoff    1       576970    jorge toni    Brianna Wilcox    1
    129003    Wedding Cake    Cinnamon Tea Cold    1       576971    Heffernan Annie    Brianna Wilcox    1

    So for the first two rows, i_ticket_id = i_ticket_id and s_item = s_item and i_ticket_item_id = i_ticket_item_id THEN only display s_choice_name
    Also, display s_menu that do not have a choice riding with them...currently my query only displays menu items that have a choice attached. I need those sales to display with or without

    THANK YOU!!!!

  • chef423 - Wednesday, June 14, 2017 12:40 PM

    Here are the 5 Tables with some sample data, taken directly from the database.

    This Query, works, but it shoes redundant data I need omitted. IF there is a line 2, I need to only display the ChoiceItem.

    Also, if there is no ChoiceItem attached to a s_item (a menu item) then I still want that Item to display, currently, only items with ChoiceItem attached are displaying. in this Query.

    Thank you!

    CREATE TABLE Ticket(
     i_ticket_id        DATE NOT NULL PRIMARY KEY
    ,i_customer_id       INTEGER NOT NULL
    ,s_table_name        VARCHAR2(20) NOT NULL
    ,c_items_total       NUMERIC(5,2) NOT NULL
    ,c_taxes_total       NUMERIC(4,2) NOT NULL
    ,c_discount_amount      NUMERIC(4,2) NOT NULL
    ,c_grand_total       NUMERIC(5,2) NOT NULL
    ,c_payment_total       NUMERIC(5,2) NOT NULL
    ,c_auto_gratuity       NUMERIC(4,2) NOT NULL
    ,f_auto_gratuity_pct     VARCHAR(4)
    ,i_void_ticket_id      VARCHAR(4)
    ,i_user_id         INTEGER NOT NULL
    ,dt_create_time       VARCHAR(23) NOT NULL
    ,dt_close_time       VARCHAR(23) NOT NULL
    ,b_closed         BIT NOT NULL
    ,dt_lock_time        VARCHAR(4)
    ,i_lock_user_id       VARCHAR(4)
    ,dt_cached_time       VARCHAR(23)
    ,i_created_by_user_id     INTEGER NOT NULL
    ,f_ticket_discount_factor    BIT NOT NULL
    ,i_ticket_revision      BIT NOT NULL
    ,i_ticket_actual_close_employee_id INTEGER NOT NULL
    ,c_ticket_tips       VARCHAR(4)
    ,i_ticket_seq_number     INTEGER NOT NULL
    ,c_ticket_display_subtotal   NUMERIC(5,2) NOT NULL
    ,c_ticket_display_tax_total   NUMERIC(4,2) NOT NULL
    ,i_ticket_timesheet_id     INTEGER NOT NULL
    ,dt_ticket_promise_time    VARCHAR(23) NOT NULL
    ,i_section_id        BIT NOT NULL
    ,i_address_id        INTEGER NOT NULL
    ,i_revcenter_id       INTEGER NOT NULL
    ,manual_hold        BIT NOT NULL
    ,choice_hold        BIT NOT NULL
    ,preauth_amount       NUMERIC(4,2) NOT NULL
    ,cover_count        BIT NOT NULL
    ,g_ticket_id        VARCHAR(36) NOT NULL
    ,rv_Ticket         INTEGER NOT NULL
    ,dt_recent_guest_check_print   VARCHAR(4)
    ,i_location_id       VARCHAR(4)
    ,s_cached_xml        VARCHAR(10018)
    ,b_use_custom_status     BIT NOT NULL
    ,s_custom_status       VARCHAR(30)
    ,s_status         VARCHAR(9) NOT NULL
    ,preauth_total_no_bar_tab    NUMERIC(4,2) NOT NULL
    ,i_active_seat_count     BIT NOT NULL
    ,dt_last_item_time      VARCHAR(23) NOT NULL
    ,dt_last_payment_time     VARCHAR(23) NOT NULL
    ,b_gratuity_removed      BIT NOT NULL
    );
    INSERT INTO mytable(i_ticket_id,i_customer_id,s_table_name,c_items_total,c_taxes_total,c_discount_amount,c_grand_total,c_payment_total,c_auto_gratuity,f_auto_gratuity_pct,i_void_ticket_id,i_user_id,dt_create_time,dt_close_time,b_closed,dt_lock_time,i_lock_user_id,dt_cached_time,i_created_by_user_id,f_ticket_discount_factor,i_ticket_revision,i_ticket_actual_close_employee_id,c_ticket_tips,i_ticket_seq_number,c_ticket_display_subtotal,c_ticket_display_tax_total,i_ticket_timesheet_id,dt_ticket_promise_time,i_section_id,i_address_id,i_revcenter_id,manual_hold,choice_hold,preauth_amount,cover_count,g_ticket_id,rv_Ticket,dt_recent_guest_check_print,i_location_id,s_cached_xml,b_use_custom_status,s_custom_status,s_status,preauth_total_no_bar_tab,i_active_seat_count,dt_last_item_time,dt_last_payment_time,b_gratuity_removed) VALUES ('130246',3029,'Mohr, Chelsey',9.00,0.00,0.00,9.00,9.00,0.00,NULL,NULL,154,'2017-06-12 15:14:25.710','2017-06-12 15:16:31.507',1,NULL,NULL,NULL,154,0,0,154,NULL,157,9.00,0.00,16009,'1753-01-01 00:00:00.000',0,3030,2,0,0,0.00,1,'AA9ABCE3-8A91-4AF9-9FD0-6873F2A161A1',0x000000000105CD05,NULL,NULL,NULL,0,NULL,'FullyPaid',0.00,1,'2017-06-12 15:14:32.770','2017-06-12 15:16:30.103',0);
    INSERT INTO mytable(i_ticket_id,i_customer_id,s_table_name,c_items_total,c_taxes_total,c_discount_amount,c_grand_total,c_payment_total,c_auto_gratuity,f_auto_gratuity_pct,i_void_ticket_id,i_user_id,dt_create_time,dt_close_time,b_closed,dt_lock_time,i_lock_user_id,dt_cached_time,i_created_by_user_id,f_ticket_discount_factor,i_ticket_revision,i_ticket_actual_close_employee_id,c_ticket_tips,i_ticket_seq_number,c_ticket_display_subtotal,c_ticket_display_tax_total,i_ticket_timesheet_id,dt_ticket_promise_time,i_section_id,i_address_id,i_revcenter_id,manual_hold,choice_hold,preauth_amount,cover_count,g_ticket_id,rv_Ticket,dt_recent_guest_check_print,i_location_id,s_cached_xml,b_use_custom_status,s_custom_status,s_status,preauth_total_no_bar_tab,i_active_seat_count,dt_last_item_time,dt_last_payment_time,b_gratuity_removed) VALUES ('130247',3324,'Barker, April',11.00,0.00,0.00,11.00,11.00,0.00,NULL,NULL,133,'2017-06-12 15:15:03.480','2017-06-12 15:16:02.537',1,NULL,NULL,NULL,133,0,0,133,NULL,158,11.00,0.00,16006,'1753-01-01 00:00:00.000',0,3325,2,0,0,0.00,1,'A70695AF-16A3-4BE0-B076-7DF0B042C6F5',0x000000000105CFAC,NULL,NULL,NULL,0,NULL,'FullyPaid',0.00,1,'2017-06-12 15:15:15.550','2017-06-12 15:16:01.100',0);
    INSERT INTO mytable(i_ticket_id,i_customer_id,s_table_name,c_items_total,c_taxes_total,c_discount_amount,c_grand_total,c_payment_total,c_auto_gratuity,f_auto_gratuity_pct,i_void_ticket_id,i_user_id,dt_create_time,dt_close_time,b_closed,dt_lock_time,i_lock_user_id,dt_cached_time,i_created_by_user_id,f_ticket_discount_factor,i_ticket_revision,i_ticket_actual_close_employee_id,c_ticket_tips,i_ticket_seq_number,c_ticket_display_subtotal,c_ticket_display_tax_total,i_ticket_timesheet_id,dt_ticket_promise_time,i_section_id,i_address_id,i_revcenter_id,manual_hold,choice_hold,preauth_amount,cover_count,g_ticket_id,rv_Ticket,dt_recent_guest_check_print,i_location_id,s_cached_xml,b_use_custom_status,s_custom_status,s_status,preauth_total_no_bar_tab,i_active_seat_count,dt_last_item_time,dt_last_payment_time,b_gratuity_removed) VALUES ('130248',2893,'Chella, Hope',11.00,0.00,0.00,11.00,11.00,0.00,NULL,NULL,176,'2017-06-12 15:21:38.417','2017-06-12 15:22:59.747',1,NULL,NULL,NULL,176,0,0,176,NULL,159,11.00,0.00,16010,'1753-01-01 00:00:00.000',0,2893,2,0,0,0.00,1,'08907A96-0B16-4CD2-80FE-3D58EB2DC9B6',0x000000000105CE07,NULL,NULL,NULL,0,NULL,'FullyPaid',0.00,1,'2017-06-12 15:22:02.627','2017-06-12 15:22:58.167',0);
    INSERT INTO mytable(i_ticket_id,i_customer_id,s_table_name,c_items_total,c_taxes_total,c_discount_amount,c_grand_total,c_payment_total,c_auto_gratuity,f_auto_gratuity_pct,i_void_ticket_id,i_user_id,dt_create_time,dt_close_time,b_closed,dt_lock_time,i_lock_user_id,dt_cached_time,i_created_by_user_id,f_ticket_discount_factor,i_ticket_revision,i_ticket_actual_close_employee_id,c_ticket_tips,i_ticket_seq_number,c_ticket_display_subtotal,c_ticket_display_tax_total,i_ticket_timesheet_id,dt_ticket_promise_time,i_section_id,i_address_id,i_revcenter_id,manual_hold,choice_hold,preauth_amount,cover_count,g_ticket_id,rv_Ticket,dt_recent_guest_check_print,i_location_id,s_cached_xml,b_use_custom_status,s_custom_status,s_status,preauth_total_no_bar_tab,i_active_seat_count,dt_last_item_time,dt_last_payment_time,b_gratuity_removed) VALUES ('130249',2185,'Brown, Cyril',11.00,0.00,0.00,11.00,11.00,0.00,NULL,NULL,133,'2017-06-12 15:36:25.593','2017-06-12 15:37:45.483',1,NULL,NULL,NULL,133,0,0,133,NULL,160,11.00,0.00,16006,'1753-01-01 00:00:00.000',0,2185,2,0,0,0.00,1,'D30A69C3-E7E8-4E25-AB6D-C2FD2EDFF76C',0x000000000105CFAD,NULL,NULL,NULL,0,NULL,'FullyPaid',0.00,1,'2017-06-12 15:36:45.527','2017-06-12 15:37:44.847',0);
    INSERT INTO mytable(i_ticket_id,i_customer_id,s_table_name,c_items_total,c_taxes_total,c_discount_amount,c_grand_total,c_payment_total,c_auto_gratuity,f_auto_gratuity_pct,i_void_ticket_id,i_user_id,dt_create_time,dt_close_time,b_closed,dt_lock_time,i_lock_user_id,dt_cached_time,i_created_by_user_id,f_ticket_discount_factor,i_ticket_revision,i_ticket_actual_close_employee_id,c_ticket_tips,i_ticket_seq_number,c_ticket_display_subtotal,c_ticket_display_tax_total,i_ticket_timesheet_id,dt_ticket_promise_time,i_section_id,i_address_id,i_revcenter_id,manual_hold,choice_hold,preauth_amount,cover_count,g_ticket_id,rv_Ticket,dt_recent_guest_check_print,i_location_id,s_cached_xml,b_use_custom_status,s_custom_status,s_status,preauth_total_no_bar_tab,i_active_seat_count,dt_last_item_time,dt_last_payment_time,b_gratuity_removed) VALUES ('130250',481,'Cappuccilli, Allison',11.00,0.00,0.00,11.00,11.00,0.00,NULL,NULL,154,'2017-06-12 15:54:36.953','2017-06-12 15:54:49.270',1,NULL,NULL,NULL,154,0,0,154,NULL,161,11.00,0.00,16009,'1753-01-01 00:00:00.000',0,481,2,0,0,0.00,1,'2BD4CF2B-3078-46F6-AE0E-C162EB20821E',0x000000000105CD06,NULL,NULL,NULL,0,NULL,'FullyPaid',0.00,1,'2017-06-12 15:54:45.040','2017-06-12 15:54:48.643',0);
    INSERT INTO mytable(i_ticket_id,i_customer_id,s_table_name,c_items_total,c_taxes_total,c_discount_amount,c_grand_total,c_payment_total,c_auto_gratuity,f_auto_gratuity_pct,i_void_ticket_id,i_user_id,dt_create_time,dt_close_time,b_closed,dt_lock_time,i_lock_user_id,dt_cached_time,i_created_by_user_id,f_ticket_discount_factor,i_ticket_revision,i_ticket_actual_close_employee_id,c_ticket_tips,i_ticket_seq_number,c_ticket_display_subtotal,c_ticket_display_tax_total,i_ticket_timesheet_id,dt_ticket_promise_time,i_section_id,i_address_id,i_revcenter_id,manual_hold,choice_hold,preauth_amount,cover_count,g_ticket_id,rv_Ticket,dt_recent_guest_check_print,i_location_id,s_cached_xml,b_use_custom_status,s_custom_status,s_status,preauth_total_no_bar_tab,i_active_seat_count,dt_last_item_time,dt_last_payment_time,b_gratuity_removed) VALUES ('130251',3886,'Chapski, Kathy',9.00,0.00,0.00,9.00,9.00,0.00,NULL,NULL,154,'2017-06-12 15:58:25.397','2017-06-12 15:58:35.257',1,NULL,NULL,NULL,154,0,0,154,NULL,162,9.00,0.00,16009,'1753-01-01 00:00:00.000',0,3887,2,0,0,0.00,1,'2E65A20C-A0FE-4491-9E4F-35729644FE79',0x000000000105CD07,NULL,NULL,NULL,0,NULL,'FullyPaid',0.00,1,'2017-06-12 15:58:28.643','2017-06-12 15:58:34.607',0);
    INSERT INTO mytable(i_ticket_id,i_customer_id,s_table_name,c_items_total,c_taxes_total,c_discount_amount,c_grand_total,c_payment_total,c_auto_gratuity,f_auto_gratuity_pct,i_void_ticket_id,i_user_id,dt_create_time,dt_close_time,b_closed,dt_lock_time,i_lock_user_id,dt_cached_time,i_created_by_user_id,f_ticket_discount_factor,i_ticket_revision,i_ticket_actual_close_employee_id,c_ticket_tips,i_ticket_seq_number,c_ticket_display_subtotal,c_ticket_display_tax_total,i_ticket_timesheet_id,dt_ticket_promise_time,i_section_id,i_address_id,i_revcenter_id,manual_hold,choice_hold,preauth_amount,cover_count,g_ticket_id,rv_Ticket,dt_recent_guest_check_print,i_location_id,s_cached_xml,b_use_custom_status,s_custom_status,s_status,preauth_total_no_bar_tab,i_active_seat_count,dt_last_item_time,dt_last_payment_time,b_gratuity_removed) VALUES ('130252',3042,'Soares, Amber',5.00,0.00,0.00,5.00,5.00,0.00,NULL,NULL,154,'2017-06-12 15:58:46.727','2017-06-12 15:58:55.840',1,NULL,NULL,NULL,154,0,0,154,NULL,163,5.00,0.00,16009,'1753-01-01 00:00:00.000',0,3043,2,0,0,0.00,1,'05F4C67F-5F85-44BD-9498-BFCAD08635F3',0x000000000105CD08,NULL,NULL,NULL,0,NULL,'FullyPaid',0.00,1,'2017-06-12 15:58:51.333','2017-06-12 15:58:55.240',0);
    INSERT INTO mytable(i_ticket_id,i_customer_id,s_table_name,c_items_total,c_taxes_total,c_discount_amount,c_grand_total,c_payment_total,c_auto_gratuity,f_auto_gratuity_pct,i_void_ticket_id,i_user_id,dt_create_time,dt_close_time,b_closed,dt_lock_time,i_lock_user_id,dt_cached_time,i_created_by_user_id,f_ticket_discount_factor,i_ticket_revision,i_ticket_actual_close_employee_id,c_ticket_tips,i_ticket_seq_number,c_ticket_display_subtotal,c_ticket_display_tax_total,i_ticket_timesheet_id,dt_ticket_promise_time,i_section_id,i_address_id,i_revcenter_id,manual_hold,choice_hold,preauth_amount,cover_count,g_ticket_id,rv_Ticket,dt_recent_guest_check_print,i_location_id,s_cached_xml,b_use_custom_status,s_custom_status,s_status,preauth_total_no_bar_tab,i_active_seat_count,dt_last_item_time,dt_last_payment_time,b_gratuity_removed) VALUES ('130253',3787,'Sorlien, Zoe',8.00,0.00,0.00,8.00,8.00,0.00,NULL,NULL,133,'2017-06-12 16:03:16.243','2017-06-12 16:03:25.133',1,NULL,NULL,NULL,133,0,0,133,NULL,164,8.00,0.00,16006,'1753-01-01 00:00:00.000',0,3788,2,0,0,0.00,1,'8EE7723D-916E-40D1-944F-E27D483A46D9',0x000000000105CFAE,NULL,NULL,NULL,0,NULL,'FullyPaid',0.00,1,'2017-06-12 16:03:20.300','2017-06-12 16:03:24.540',0);
    INSERT INTO mytable(i_ticket_id,i_customer_id,s_table_name,c_items_total,c_taxes_total,c_discount_amount,c_grand_total,c_payment_total,c_auto_gratuity,f_auto_gratuity_pct,i_void_ticket_id,i_user_id,dt_create_time,dt_close_time,b_closed,dt_lock_time,i_lock_user_id,dt_cached_time,i_created_by_user_id,f_ticket_discount_factor,i_ticket_revision,i_ticket_actual_close_employee_id,c_ticket_tips,i_ticket_seq_number,c_ticket_display_subtotal,c_ticket_display_tax_total,i_ticket_timesheet_id,dt_ticket_promise_time,i_section_id,i_address_id,i_revcenter_id,manual_hold,choice_hold,preauth_amount,cover_count,g_ticket_id,rv_Ticket,dt_recent_guest_check_print,i_location_id,s_cached_xml,b_use_custom_status,s_custom_status,s_status,preauth_total_no_bar_tab,i_active_seat_count,dt_last_item_time,dt_last_payment_time,b_gratuity_removed) VALUES ('130254',3790,'Smith, Emma',9.00,0.00,0.00,9.00,9.00,0.00,NULL,NULL,176,'2017-06-12 16:13:01.620','2017-06-12 16:13:08.727',1,NULL,NULL,NULL,176,0,0,176,NULL,165,9.00,0.00,16010,'1753-01-01 00:00:00.000',0,3791,2,0,0,0.00,1,'E39824B6-925D-4980-B1BB-BBE4552C04F2',0x000000000105CE08,NULL,NULL,NULL,0,NULL,'FullyPaid',0.00,1,'2017-06-12 16:13:03.563','2017-06-12 16:13:07.920',0);
    INSERT INTO mytable(i_ticket_id,i_customer_id,s_table_name,c_items_total,c_taxes_total,c_discount_amount,c_grand_total,c_payment_total,c_auto_gratuity,f_auto_gratuity_pct,i_void_ticket_id,i_user_id,dt_create_time,dt_close_time,b_closed,dt_lock_time,i_lock_user_id,dt_cached_time,i_created_by_user_id,f_ticket_discount_factor,i_ticket_revision,i_ticket_actual_close_employee_id,c_ticket_tips,i_ticket_seq_number,c_ticket_display_subtotal,c_ticket_display_tax_total,i_ticket_timesheet_id,dt_ticket_promise_time,i_section_id,i_address_id,i_revcenter_id,manual_hold,choice_hold,preauth_amount,cover_count,g_ticket_id,rv_Ticket,dt_recent_guest_check_print,i_location_id,s_cached_xml,b_use_custom_status,s_custom_status,s_status,preauth_total_no_bar_tab,i_active_seat_count,dt_last_item_time,dt_last_payment_time,b_gratuity_removed) VALUES ('130255',1369,'REED, BOB',20.00,0.00,0.00,20.00,20.00,0.00,NULL,NULL,176,'2017-06-12 16:15:45.210','2017-06-12 16:17:12.033',1,NULL,NULL,NULL,176,0,0,176,NULL,166,20.00,0.00,16010,'1753-01-01 00:00:00.000',0,1369,2,0,0,0.00,1,'07098FA2-77D1-4C48-AD51-7AEB33308D2B',0x000000000105CE09,NULL,NULL,NULL,0,NULL,'FullyPaid',0.00,1,'2017-06-12 16:16:52.343','2017-06-12 16:17:11.300',0);
    INSERT INTO mytable(i_ticket_id,i_customer_id,s_table_name,c_items_total,c_taxes_total,c_discount_amount,c_grand_total,c_payment_total,c_auto_gratuity,f_auto_gratuity_pct,i_void_ticket_id,i_user_id,dt_create_time,dt_close_time,b_closed,dt_lock_time,i_lock_user_id,dt_cached_time,i_created_by_user_id,f_ticket_discount_factor,i_ticket_revision,i_ticket_actual_close_employee_id,c_ticket_tips,i_ticket_seq_number,c_ticket_display_subtotal,c_ticket_display_tax_total,i_ticket_timesheet_id,dt_ticket_promise_time,i_section_id,i_address_id,i_revcenter_id,manual_hold,choice_hold,preauth_amount,cover_count,g_ticket_id,rv_Ticket,dt_recent_guest_check_print,i_location_id,s_cached_xml,b_use_custom_status,s_custom_status,s_status,preauth_total_no_bar_tab,i_active_seat_count,dt_last_item_time,dt_last_payment_time,b_gratuity_removed) VALUES ('130256',3887,'Smith, Chris',9.00,0.00,0.00,9.00,9.00,0.00,NULL,NULL,1,'2017-06-13 09:00:21.150','2017-06-13 09:00:33.923',1,NULL,NULL,NULL,1,0,0,1,NULL,1,9.00,0.00,16014,'1753-01-01 00:00:00.000',0,3888,2,0,0,0.00,1,'5815A088-D1EC-4F39-9778-5305130235C0',0x000000000105DCE4,NULL,NULL,NULL,0,NULL,'FullyPaid',0.00,1,'2017-06-13 09:00:24.520','2017-06-13 09:00:33.723',0);
    INSERT INTO mytable(i_ticket_id,i_customer_id,s_table_name,c_items_total,c_taxes_total,c_discount_amount,c_grand_total,c_payment_total,c_auto_gratuity,f_auto_gratuity_pct,i_void_ticket_id,i_user_id,dt_create_time,dt_close_time,b_closed,dt_lock_time,i_lock_user_id,dt_cached_time,i_created_by_user_id,f_ticket_discount_factor,i_ticket_revision,i_ticket_actual_close_employee_id,c_ticket_tips,i_ticket_seq_number,c_ticket_display_subtotal,c_ticket_display_tax_total,i_ticket_timesheet_id,dt_ticket_promise_time,i_section_id,i_address_id,i_revcenter_id,manual_hold,choice_hold,preauth_amount,cover_count,g_ticket_id,rv_Ticket,dt_recent_guest_check_print,i_location_id,s_cached_xml,b_use_custom_status,s_custom_status,s_status,preauth_total_no_bar_tab,i_active_seat_count,dt_last_item_time,dt_last_payment_time,b_gratuity_removed) VALUES ('130257',0,'InPayments #2',9.00,0.00,0.00,9.00,9.00,0.00,NULL,NULL,1,'2017-06-13 09:00:52.883','2017-06-13 09:00:54.213',1,NULL,NULL,'2017-06-13 09:43:16.370',1,0,0,1,NULL,2,9.00,0.00,16014,'1753-01-01 00:00:00.000',0,0,2,0,0,0.00,1,'F9212DE4-1FB9-41A2-9D7C-B3C11BE1D2A4',0x000000000105DCE5,NULL,NULL,'<Ticket xmlns="http://schemas.datacontract.org/2004/07/Dinerware" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><InstanceGuid>f9212de4-1fb9-41a2-9d7c-b3c11be1d2a4</InstanceGuid><ActiveSeatcount>1</ActiveSeatcount><AutoGratApplicableAmount>9.00</AutoGratApplicableAmount><CloseTime>2017-06-13T09:00:54.213-07:00</CloseTime><CoverCount>1</CoverCount><CreateTime>2017-06-13T09:00:52.883-07:00</CreateTime><CustomStatus/><Discounts/><FastPayCashDrawer/><FirstItemTime>2017-06-13T09:00:52.89-07:00</FirstItemTime><Gratuity><Amount>0</Amount><ManualAmount>false</ManualAmount><Percent>0</Percent><Removed>false</Removed></Gratuity><ID>130257</ID><LastGuestCheckPrint>0001-01-01T00:00:00</LastGuestCheckPrint><LastItemTime>2017-06-13T09:00:48.763-07:00</LastItemTime><LastPaymentTime>2017-06-13T09:00:54.08-07:00</LastPaymentTime><LocationID>0</LocationID><Memberships/><OwnerID>1</OwnerID><PaymentTotal>9.0000</PaymentTotal><Payments/><PotentialSurcharges/><PromiseTime>1753-01-01T00:00:00</PromiseTime><RealSubtotal>9.0000</RealSubtotal><RevCenterId>2</RevCenterId><RevCenterName>Nutrition Club</RevCenterName><Seats><Cover><Id>74647</Id><Index>1</Index><Selected>false</Selected><TicketItems><MenuItem><InstanceGuid>62f4d307-f115-4504-8e9c-6e06e345827f</InstanceGuid><Active>false</Active><AlwaysShowSpecialRequest>false</AlwaysShowSpecialRequest><ApplicableTicketDiscountsString/><ApplicableTicketTaxesString/><ChoiceCats><ChoiceCategory><Active>false</Active><AlternateKprintName/><BartenderExemption>false</BartenderExemption><CatQuantityBehavior>SameAsParent</CatQuantityBehavior><CategoryName>TEA FLAVOR:</CategoryName><Choices><Choice><Active>true</Active><ChoiceAlternateKprintName/><ChoiceCategories/><ChoiceName>Cinnamon Tea Cold</ChoiceName><Cost>0</Cost><CourseID>0</CourseID><ID>133</ID><OriginalQuantity>1.0000</OriginalQuantity><OriginalShareQuantity>1</OriginalShareQuantity><OverrideCategoryPrice>false</OverrideCategoryPrice><PriceModifier>0</PriceModifier><PriceModifierPct>0</PriceModifierPct><PrintRed>false</PrintRed><Quantity>1.0000</Quantity><SKU i:nil="true"/><TicketChoiceID>162941</TicketChoiceID><TimeAdded>2017-06-13T09:00:50.863-07:00</TimeAdded><UsesPercent>false</UsesPercent></Choice></Choices><ID>25</ID><InheritPricing>false</InheritPricing><InstanceID>369317</InstanceID><IsOptional>false</IsOptional><MaxChoiceQty>1</MaxChoiceQty><MinChoiceQty>1</MinChoiceQty><MultiSelect>false</MultiSelect><ParentChoiceInstanceID/><PrependName>false</PrependName><PriceModifier>0</PriceModifier><PriceModifierPct>0</PriceModifierPct><PrintRed>false</PrintRed><Timid>false</Timid><UsesPercent>false</UsesPercent></ChoiceCategory><ChoiceCategory><Active>false</Active><AlternateKprintName/><BartenderExemption>false</BartenderExemption><CatQuantityBehavior>SameAsParent</CatQuantityBehavior><CategoryName>ALOE SHOT:</CategoryName><Choices><Choice><Active>true</Active><ChoiceAlternateKprintName/><ChoiceCategories/><ChoiceName>Cranberry Aloe Shot</ChoiceName><Cost>0</Cost><CourseID>0</CourseID><ID>119</ID><OriginalQuantity>1.0000</OriginalQuantity><OriginalShareQuantity>1</OriginalShareQuantity><OverrideCategoryPrice>false</OverrideCategoryPrice><PriceModifier>0</PriceModifier><PriceModifierPct>0</PriceModifierPct><PrintRed>false</PrintRed><Quantity>1.0000</Quantity><SKU i:nil="true"/><TicketChoiceID>162942</TicketChoiceID><TimeAdded>2017-06-13T09:00:51.6-07:00</TimeAdded><UsesPercent>false</UsesPercent></Choice></Choices><ID>26</ID><InheritPricing>false</InheritPricing><InstanceID>369318</InstanceID><IsOptional>false</IsOptional><MaxChoiceQty>1</MaxChoiceQty><MinChoiceQty>1</MinChoiceQty><MultiSelect>false</MultiSelect><ParentChoiceInstanceID/><PrependName>false</PrependName><PriceModifier>0</PriceModifier><PriceModifierPct>0</PriceModifierPct><PrintRed>false</PrintRed><Timid>false</Timid><UsesPercent>false</UsesPercent></ChoiceCategory><ChoiceCategory><Active>true</Active><AlternateKprintName/><BartenderExemption>false</BartenderExemption><CatQuantityBehavior>SameAsParent</CatQuantityBehavior><CategoryName>PROTEIN SUBSTITUTION:</CategoryName><Choices/><DefaultChoiceID>0</DefaultChoiceID><ID>27</ID><InheritPricing>true</InheritPricing><InstanceID/><IsOptional>true</IsOptional><MaxChoiceQty>1</MaxChoiceQty><MinChoiceQty>1</MinChoiceQty><MultiSelect>false</MultiSelect><Ordinal>9</Ordinal><ParentChoiceInstanceID/><PrependName>true</PrependName><PriceModifier>0</PriceModifier><PriceModifierPct>0</PriceModifierPct><PrintRed>false</PrintRed><Timid>true</Timid><UsesPercent>false</UsesPercent></ChoiceCategory><ChoiceCategory><Active>true</Active><AlternateKprintName/><BartenderExemption>false</BartenderExemption><CatQuantityBehavior>SameAsParent</CatQuantityBehavior><CategoryName>UPGRADES:</CategoryName><Choices/><DefaultChoiceID>0</DefaultChoiceID><ID>21</ID><InheritPricing>false</InheritPricing><InstanceID/><IsOptional>true</IsOptional><MaxChoiceQty>1</MaxChoiceQty><MinChoiceQty>1</MinChoiceQty><MultiSelect>false</MultiSelect><Ordinal>10</Ordinal><ParentChoiceInstanceID/><PrependName>true</PrependName><PriceModifier>0</PriceModifier><PriceModifierPct>0</PriceModifierPct><PrintRed>false</PrintRed><Timid>false</Timid><UsesPercent>false</UsesPercent></ChoiceCategory><ChoiceCategory><Active>true</Active><AlternateKprintName/><BartenderExemption>false</BartenderExemption><CatQuantityBehavior>SameAsParent</CatQuantityBehavior><CategoryName>ADD:</CategoryName><Choices/><DefaultChoiceID>0</DefaultChoiceID><ID>24</ID><InheritPricing>false</InheritPricing><InstanceID/><IsOptional>true</IsOptional><MaxChoiceQty>1</MaxChoiceQty><MinChoiceQty>1</MinChoiceQty><MultiSelect>true</MultiSelect><Ordinal>11</Ordinal><ParentChoiceInstanceID/><PrependName>true</PrependName><PriceModifier>0</PriceModifier><PriceModifierPct>0</PriceModifierPct><PrintRed>false</PrintRed><Timid>false</Timid><UsesPercent>false</UsesPercent></ChoiceCategory></ChoiceCats><Choices><Choice><Active>true</Active><ChoiceAlternateKprintName/><ChoiceCategories/><ChoiceName>Cinnamon Tea Cold</ChoiceName><Cost>0</Cost><CourseID>0</CourseID><ID>133</ID><OriginalQuantity>1.0000</OriginalQuantity><OriginalShareQuantity>1</OriginalShareQuantity><OverrideCategoryPrice>false</OverrideCategoryPrice><PriceModifier>0</PriceModifier><PriceModifierPct>0</PriceModifierPct><PrintRed>false</PrintRed><Quantity>1.0000</Quantity><SKU i:nil="true"/><TicketChoiceID>162941</TicketChoiceID><TimeAdded>2017-06-13T09:00:50.863-07:00</TimeAdded><UsesPercent>false</UsesPercent></Choice><Choice><Active>true</Active><ChoiceAlternateKprintName/><ChoiceCategories/><ChoiceName>Cranberry Aloe Shot</ChoiceName><Cost>0</Cost><CourseID>0</CourseID><ID>119</ID><OriginalQuantity>1.0000</OriginalQuantity><OriginalShareQuantity>1</OriginalShareQuantity><OverrideCategoryPrice>false</OverrideCategoryPrice><PriceModifier>0</PriceModifier><PriceModifierPct>0</PriceModifierPct><PrintRed>false</PrintRed><Quantity>1.0000</Quantity><SKU i:nil="true"/><TicketChoiceID>162942</TicketChoiceID><TimeAdded>2017-06-13T09:00:51.6-07:00</TimeAdded><UsesPercent>false</UsesPercent></Choice></Choices><CommitTime>2017-06-13T09:00:52.89-07:00</CommitTime><Cost>0</Cost><DecimalSplit>1</DecimalSplit><DefaultQuantity>1</DefaultQuantity><Description/><Discounts/><DisplayPrice>9.0000</DisplayPrice><ExpandedPrice>9.0000</ExpandedPrice><FractionSplit>1</FractionSplit><ID>505</ID><ItemName>Samoas</ItemName><MenuDescription/><NoPrint>false</NoPrint><OpenItem>false</OpenItem><OriginalAddTime>2017-06-13T09:00:48.763-07:00</OriginalAddTime><Price>9.0000</Price><PriceCatID>46</PriceCatID><PriceLevelChoiceCategory>-1</PriceLevelChoiceCategory><PriceXQuantity>9.0000</PriceXQuantity><Quantity>1</Quantity><RealQty>1</RealQty><RevenueCenterID>2</RevenueCenterID><RevenueCenterName>Nutrition Club</RevenueCenterName><RevenueClassID>12</RevenueClassID><RevenueClassName>Shakes</RevenueClassName><SKU/><SoldByWeight>false</SoldByWeight><SpecialGrossWithOnlyHiddenTaxRemoved>9.0000</SpecialGrossWithOnlyHiddenTaxRemoved><SpecialRequest/><SplitGroup>1</SplitGroup><TIID>579175</TIID><TareWeight>0</TareWeight><Taxes/><UsesFixedPrice>false</UsesFixedPrice></MenuItem></TicketItems></Cover></Seats><SequenceNum>2</SequenceNum><Status>FullyPaid</Status><Subtotal>9.0000</Subtotal><TableName>InPayments #2</TableName><Taxes><Tax><Active>true</Active><AddInData/><AppliesAll>false</AppliesAll><AppliesGratuity>true</AppliesGratuity><ExtraHeaderLineText/><ExtraHeaderLineTwo/><ExtraHeaderOnGuestChecks>false</ExtraHeaderOnGuestChecks><ExtraHeaderOnReceipts>false</ExtraHeaderOnReceipts><FlatFeeAmount>0</FlatFeeAmount><GratuityAppliesAfterVAT>false</GratuityAppliesAfterVAT><HiddenTaxOrder>-1</HiddenTaxOrder><HideWhenAllLiquor>false</HideWhenAllLiquor><ID>16</ID><Inclusive>false</Inclusive><IsFloridaTax>false</IsFloridaTax><IsProRatedInstance>false</IsProRatedInstance><IsVAT>false</IsVAT><Level>1</Level><MarkCharacter/><MarkItems>false</MarkItems><MarkLegend/><MenuItemIDs xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays"/><NonLiquor>false</NonLiquor><PerPersonThreshold>false</PerPersonThreshold><PerPersonThresholdAmount>0</PerPersonThresholdAmount><Percent>0.07</Percent><RCThreshold>false</RCThreshold><RCThresholdAmount>0</RCThresholdAmount><RateName>7% Tax (Catalog)</RateName><Reason/><RemovedAmount>0</RemovedAmount><RevClassIDs xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays"><a:int>11</a:int></RevClassIDs><RevenueCenterIds xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays"/><RoundingType>normal</RoundingType><SectionIds xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays"/><ShowActualPrice>false</ShowActualPrice><ShowExtraHeaderLine>false</ShowExtraHeaderLine><ShowSubtotalLine>true</ShowSubtotalLine><SubtotalLineText>Tax + S&amp;H</SubtotalLineText><TotalAmount>0</TotalAmount><UsesFlatFee>false</UsesFlatFee><isTicketLevel>false</isTicketLevel></Tax></Taxes><Total>9.0000</Total><UseCustomStatus>false</UseCustomStatus><UserID>1</UserID><UserName/></Ticket>',0,NULL,'FullyPaid',0.00,1,'2017-06-13 09:00:48.763','2017-06-13 09:00:54.080',0);
    INSERT INTO mytable(i_ticket_id,i_customer_id,s_table_name,c_items_total,c_taxes_total,c_discount_amount,c_grand_total,c_payment_total,c_auto_gratuity,f_auto_gratuity_pct,i_void_ticket_id,i_user_id,dt_create_time,dt_close_time,b_closed,dt_lock_time,i_lock_user_id,dt_cached_time,i_created_by_user_id,f_ticket_discount_factor,i_ticket_revision,i_ticket_actual_close_employee_id,c_ticket_tips,i_ticket_seq_number,c_ticket_display_subtotal,c_ticket_display_tax_total,i_ticket_timesheet_id,dt_ticket_promise_time,i_section_id,i_address_id,i_revcenter_id,manual_hold,choice_hold,preauth_amount,cover_count,g_ticket_id,rv_Ticket,dt_recent_guest_check_print,i_location_id,s_cached_xml,b_use_custom_status,s_custom_status,s_status,preauth_total_no_bar_tab,i_active_seat_count,dt_last_item_time,dt_last_payment_time,b_gratuity_removed) VALUES ('130258',3887,'InPayments #3',4.00,0.00,0.00,4.00,4.00,0.00,NULL,NULL,1,'2017-06-13 09:37:39.773','2017-06-13 09:37:41.190',1,NULL,NULL,'2017-06-13 09:43:18.107',1,0,0,1,NULL,3,4.00,0.00,16014,'1753-01-01 00:00:00.000',0,3888,2,0,0,0.00,1,'707A5E08-715E-4DA8-9D3B-24FBEC6B0842',0x000000000105DCE6,NULL,NULL,'<Ticket xmlns="http://schemas.datacontract.org/2004/07/Dinerware" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><InstanceGuid>707a5e08-715e-4da8-9d3b-24fbec6b0842</InstanceGuid><ActiveSeatcount>1</ActiveSeatcount><AddressID>3888</AddressID><AutoGratApplicableAmount>4.00</AutoGratApplicableAmount><CloseTime>2017-06-13T09:37:41.19-07:00</CloseTime><CoverCount>1</CoverCount><CreateTime>2017-06-13T09:37:39.773-07:00</CreateTime><CustomStatus/><Customer><InstanceGuid>d71f6c6e-da19-40e2-b731-adf3b3066e69</InstanceGuid><Active>true</Active><Anniversary>1900-01-01T00:00:00-08:00</Anniversary><Birthday>1900-01-01T00:00:00-08:00</Birthday><CallerID/><CurrentId>3887</CurrentId><DateAdded>2017-06-13T09:00:16.32-07:00</DateAdded><DateEdited>2017-06-13T09:00:16.32-07:00</DateEdited><EditedByUserId>1</EditedByUserId><EditedByUserName>InPayments</EditedByUserName><Email/><Email2/><FName>Chris</FName><ID>3887</ID><IsAnonymous>false</IsAnonymous><IsChanged>true</IsChanged><IsDeleted>false</IsDeleted><IsNew>false</IsNew><LName>Smith</LName><MembershipCardInfo/><MembershipID>156156</MembershipID><Notes/><OriginalId>3887</OriginalId><Phone>7075673304</Phone><theAddresses><Address><Address1>1060 Elfstone Ct</Address1><Address2/><AddressType/><City>Westlake Village</City><CurrentId>3888</CurrentId><ID>3888</ID><IsActive>true</IsActive><IsChanged>true</IsChanged><IsDeleted>false</IsDeleted><IsNew>false</IsNew><Name/><Note/><OriginalId>3888</OriginalId><PersonID>3887</PersonID><Phone/><PostalCode>91361</PostalCode><State>CA</State><SupercededById>-1</SupercededById></Address></theAddresses></Customer><Discounts/><FastPayCashDrawer/><FirstItemTime>2017-06-13T09:37:39.78-07:00</FirstItemTime><Gratuity><Amount>0</Amount><ManualAmount>false</ManualAmount><Percent>0</Percent><Removed>false</Removed></Gratuity><ID>130258</ID><LastGuestCheckPrint>0001-01-01T00:00:00</LastGuestCheckPrint><LastItemTime>2017-06-13T09:37:18.153-07:00</LastItemTime><LastPaymentTime>2017-06-13T09:37:41.06-07:00</LastPaymentTime><LocationID>0</LocationID><Memberships/><OwnerID>1</OwnerID><PaymentTotal>4.0000</PaymentTotal><Payments/><PotentialSurcharges/><PromiseTime>1753-01-01T00:00:00</PromiseTime><RealSubtotal>4.0000</RealSubtotal><RevCenterId>2</RevCenterId><RevCenterName>Nutrition Club</RevCenterName><Seats><Cover><Id>74648</Id><Index>1</Index><Selected>false</Selected><TicketItems><MenuItem><InstanceGuid>f0caaca7-d47f-4536-9f4c-6a4fd53f8696</InstanceGuid><Active>false</Active><AlwaysShowSpecialRequest>false</AlwaysShowSpecialRequest><ApplicableTicketDiscountsString/><ApplicableTicketTaxesString/><ChoiceCats/><Choices/><CommitTime>2017-06-13T09:37:39.78-07:00</CommitTime><Cost>0</Cost><DecimalSplit>1</DecimalSplit><DefaultQuantity>1</DefaultQuantity><Description/><Discounts/><DisplayPrice>2.0000</DisplayPrice><ExpandedPrice>2.0000</ExpandedPrice><FractionSplit>1</FractionSplit><ID>541</ID><ItemName>Orange H3O</ItemName><MenuDescription/><NoPrint>false</NoPrint><OpenItem>false</OpenItem><OriginalAddTime>2017-06-13T09:37:17.58-07:00</OriginalAddTime><Price>2.0000</Price><PriceCatID>-1</PriceCatID><PriceLevelChoiceCategory>-1</PriceLevelChoiceCategory><PriceXQuantity>2.0000</PriceXQuantity><Quantity>1</Quantity><RealQty>1</RealQty><RevenueCenterID>2</RevenueCenterID><RevenueCenterName>Nutrition Club</RevenueCenterName><RevenueClassID>18</RevenueClassID><RevenueClassName>Functional</RevenueClassName><SKU/><SoldByWeight>false</SoldByWeight><SpecialGrossWithOnlyHiddenTaxRemoved>2.0000</SpecialGrossWithOnlyHiddenTaxRemoved><SpecialRequest/><SplitGroup>1</SplitGroup><TIID>579176</TIID><TareWeight>0</TareWeight><Taxes/><UsesFixedPrice>false</UsesFixedPrice></MenuItem><MenuItem><InstanceGuid>db44e614-1487-4e2c-8787-e9aeafe9cd1f</InstanceGuid><Active>false</Active><AlwaysShowSpecialRequest>false</AlwaysShowSpecialRequest><ApplicableTicketDiscountsString/><ApplicableTicketTaxesString/><ChoiceCats/><Choices/><CommitTime>2017-06-13T09:37:39.787-07:00</CommitTime><Cost>0</Cost><DecimalSplit>1</DecimalSplit><DefaultQuantity>1</DefaultQuantity><Description/><Discounts/><DisplayPrice>2.0000</DisplayPrice><ExpandedPrice>2.0000</ExpandedPrice><FractionSplit>1</FractionSplit><ID>541</ID><ItemName>Orange H3O</ItemName><MenuDescription/><NoPrint>false</NoPrint><OpenItem>false</OpenItem><OriginalAddTime>2017-06-13T09:37:18.153-07:00</OriginalAddTime><Price>2.0000</Price><PriceCatID>-1</PriceCatID><PriceLevelChoiceCategory>-1</PriceLevelChoiceCategory><PriceXQuantity>2.0000</PriceXQuantity><Quantity>1</Quantity><RealQty>1</RealQty><RevenueCenterID>2</RevenueCenterID><RevenueCenterName>Nutrition Club</RevenueCenterName><RevenueClassID>18</RevenueClassID><RevenueClassName>Functional</RevenueClassName><SKU/><SoldByWeight>false</SoldByWeight><SpecialGrossWithOnlyHiddenTaxRemoved>2.0000</SpecialGrossWithOnlyHiddenTaxRemoved><SpecialRequest/><SplitGroup>2</SplitGroup><TIID>579177</TIID><TareWeight>0</TareWeight><Taxes/><UsesFixedPrice>false</UsesFixedPrice></MenuItem></TicketItems></Cover></Seats><SequenceNum>3</SequenceNum><Status>FullyPaid</Status><Subtotal>4.0000</Subtotal><TableName>InPayments #3</TableName><Taxes><Tax><Active>true</Active><AddInData/><AppliesAll>false</AppliesAll><AppliesGratuity>true</AppliesGratuity><ExtraHeaderLineText/><ExtraHeaderLineTwo/><ExtraHeaderOnGuestChecks>false</ExtraHeaderOnGuestChecks><ExtraHeaderOnReceipts>false</ExtraHeaderOnReceipts><FlatFeeAmount>0</FlatFeeAmount><GratuityAppliesAfterVAT>false</GratuityAppliesAfterVAT><HiddenTaxOrder>-1</HiddenTaxOrder><HideWhenAllLiquor>false</HideWhenAllLiquor><ID>16</ID><Inclusive>false</Inclusive><IsFloridaTax>false</IsFloridaTax><IsProRatedInstance>false</IsProRatedInstance><IsVAT>false</IsVAT><Level>1</Level><MarkCharacter/><MarkItems>false</MarkItems><MarkLegend/><MenuItemIDs xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays"/><NonLiquor>false</NonLiquor><PerPersonThreshold>false</PerPersonThreshold><PerPersonThresholdAmount>0</PerPersonThresholdAmount><Percent>0.07</Percent><RCThreshold>false</RCThreshold><RCThresholdAmount>0</RCThresholdAmount><RateName>7% Tax (Catalog)</RateName><Reason/><RemovedAmount>0</RemovedAmount><RevClassIDs xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays"><a:int>11</a:int></RevClassIDs><RevenueCenterIds xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays"/><RoundingType>normal</RoundingType><SectionIds xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays"/><ShowActualPrice>false</ShowActualPrice><ShowExtraHeaderLine>false</ShowExtraHeaderLine><ShowSubtotalLine>true</ShowSubtotalLine><SubtotalLineText>Tax + S&amp;H</SubtotalLineText><TotalAmount>0</TotalAmount><UsesFlatFee>false</UsesFlatFee><isTicketLevel>false</isTicketLevel></Tax></Taxes><Total>4.0000</Total><UseCustomStatus>false</UseCustomStatus><UserID>1</UserID><UserName/></Ticket>',0,NULL,'FullyPaid',0.00,1,'2017-06-13 09:37:18.153','2017-06-13 09:37:41.060',0);
    INSERT INTO mytable(i_ticket_id,i_customer_id,s_table_name,c_items_total,c_taxes_total,c_discount_amount,c_grand_total,c_payment_total,c_auto_gratuity,f_auto_gratuity_pct,i_void_ticket_id,i_user_id,dt_create_time,dt_close_time,b_closed,dt_lock_time,i_lock_user_id,dt_cached_time,i_created_by_user_id,f_ticket_discount_factor,i_ticket_revision,i_ticket_actual_close_employee_id,c_ticket_tips,i_ticket_seq_number,c_ticket_display_subtotal,c_ticket_display_tax_total,i_ticket_timesheet_id,dt_ticket_promise_time,i_section_id,i_address_id,i_revcenter_id,manual_hold,choice_hold,preauth_amount,cover_count,g_ticket_id,rv_Ticket,dt_recent_guest_check_print,i_location_id,s_cached_xml,b_use_custom_status,s_custom_status,s_status,preauth_total_no_bar_tab,i_active_seat_count,dt_last_item_time,dt_last_payment_time,b_gratuity_removed) VALUES ('130259',3887,'InPayments #4',2.00,0.00,0.00,2.00,2.00,0.00,NULL,NULL,1,'2017-06-13 09:43:55.637','2017-06-13 09:43:57.067',1,NULL,NULL,NULL,1,0,0,1,NULL,5,2.00,0.00,16014,'1753-01-01 00:00:00.000',0,3888,2,0,0,0.00,1,'72A093C5-2BB8-4122-AD23-4859DCF3A13F',0x000000000105DCE7,NULL,NULL,NULL,0,NULL,'FullyPaid',0.00,1,'2017-06-13 09:43:41.653','2017-06-13 09:43:56.980',0);
    INSERT INTO mytable(i_ticket_id,i_customer_id,s_table_name,c_items_total,c_taxes_total,c_discount_amount,c_grand_total,c_payment_total,c_auto_gratuity,f_auto_gratuity_pct,i_void_ticket_id,i_user_id,dt_create_time,dt_close_time,b_closed,dt_lock_time,i_lock_user_id,dt_cached_time,i_created_by_user_id,f_ticket_discount_factor,i_ticket_revision,i_ticket_actual_close_employee_id,c_ticket_tips,i_ticket_seq_number,c_ticket_display_subtotal,c_ticket_display_tax_total,i_ticket_timesheet_id,dt_ticket_promise_time,i_section_id,i_address_id,i_revcenter_id,manual_hold,choice_hold,preauth_amount,cover_count,g_ticket_id,rv_Ticket,dt_recent_guest_check_print,i_location_id,s_cached_xml,b_use_custom_status,s_custom_status,s_status,preauth_total_no_bar_tab,i_active_seat_count,dt_last_item_time,dt_last_payment_time,b_gratuity_removed) VALUES ('130260',0,'Cashier Test #5',45.00,0.00,0.00,45.00,45.00,0.00,NULL,NULL,179,'2017-06-14 08:51:59.887','2017-06-14 08:52:01.790',1,NULL,NULL,NULL,179,0,0,179,NULL,1,45.00,0.00,16051,'1753-01-01 00:00:00.000',0,0,0,0,0,0.00,1,'4F02E42E-EACD-4E81-9A6D-72B7FE4702EA',0x000000000105E7AB,NULL,NULL,NULL,0,NULL,'FullyPaid',0.00,1,'2017-06-14 08:51:58.947','2017-06-14 08:52:01.567',0);


    CREATE TABLE TicketItem(
     i_ticket_item_id       INTEGER NOT NULL PRIMARY KEY
    ,i_ticket_id         DATE NOT NULL
    ,i_menu_item_id        INTEGER NOT NULL
    ,s_item          VARCHAR(22) NOT NULL
    ,dt_when          VARCHAR(23) NOT NULL
    ,c_price          NUMERIC(4,2) NOT NULL
    ,c_discount_amount       NUMERIC(4,2) NOT NULL
    ,c_tax_total         VARCHAR(4)
    ,i_employee_id        INTEGER NOT NULL
    ,i_cover_id         INTEGER NOT NULL
    ,i_void_item_id        VARCHAR(4)
    ,i_held          BIT NOT NULL
    ,b_printed         VARCHAR(4)
    ,i_split_group        INTEGER NOT NULL
    ,f_split          BIT NOT NULL
    ,i_held_for_choice       BIT NOT NULL
    ,s_qty           BIT NOT NULL
    ,c_ticketitem_choices_amount   NUMERIC(4,2) NOT NULL
    ,c_ticketitem_net_price     NUMERIC(4,2) NOT NULL
    ,f_ticketitem_ticket_discount_factor BIT NOT NULL
    ,i_ticketitem_actual_employee_id  INTEGER NOT NULL
    ,c_ticketitem_tip_share     VARCHAR(4)
    ,f_ticketitem_share_qty     BIT NOT NULL
    ,f_ticketitem_real_qty     BIT NOT NULL
    ,i_ticketitem_timesheet_id    INTEGER NOT NULL
    ,c_ticketitem_gross_price    NUMERIC(4,2) NOT NULL
    ,c_ticketitem_manual_discounts   NUMERIC(4,2) NOT NULL
    ,c_ticketitem_auto_discounts   NUMERIC(4,2) NOT NULL
    ,i_ti_customer_id       INTEGER NOT NULL
    ,i_ti_void_ticket_id      VARCHAR(4)
    ,i_ti_customer_orig_id     INTEGER
    ,dt_ti_ticket_close_time     VARCHAR(23) NOT NULL
    ,i_ti_revcenter_id       INTEGER NOT NULL
    ,c_hidden_taxes        NUMERIC(4,2) NOT NULL
    ,i_course_id         BIT NOT NULL
    ,original_add_time       VARCHAR(23) NOT NULL
    ,s_applicable_ticket_discounts   VARCHAR(30)
    ,s_applicable_ticket_taxes    VARCHAR(30)
    ,s_special_request       VARCHAR(30)
    ,g_ticketitem_id       VARCHAR(36) NOT NULL
    ,c_autograt_amount       NUMERIC(4,2) NOT NULL
    ,rv_TicketItem        INTEGER NOT NULL
    ,g_combination_guid      VARCHAR(36) NOT NULL
    );
    INSERT INTO mytable(i_ticket_item_id,i_ticket_id,i_menu_item_id,s_item,dt_when,c_price,c_discount_amount,c_tax_total,i_employee_id,i_cover_id,i_void_item_id,i_held,b_printed,i_split_group,f_split,i_held_for_choice,s_qty,c_ticketitem_choices_amount,c_ticketitem_net_price,f_ticketitem_ticket_discount_factor,i_ticketitem_actual_employee_id,c_ticketitem_tip_share,f_ticketitem_share_qty,f_ticketitem_real_qty,i_ticketitem_timesheet_id,c_ticketitem_gross_price,c_ticketitem_manual_discounts,c_ticketitem_auto_discounts,i_ti_customer_id,i_ti_void_ticket_id,i_ti_customer_orig_id,dt_ti_ticket_close_time,i_ti_revcenter_id,c_hidden_taxes,i_course_id,original_add_time,s_applicable_ticket_discounts,s_applicable_ticket_taxes,s_special_request,g_ticketitem_id,c_autograt_amount,rv_TicketItem,g_combination_guid) VALUES (579166,'130251',522,'Wedding Cake','2017-06-12 15:58:32.403',9.00,0.00,NULL,154,74641,NULL,0,NULL,1,1,0,1,0.00,9.00,0,154,NULL,1,1,16009,9.00,0.00,0.00,3886,NULL,3886,'2017-06-12 15:58:35.257',2,0.00,0,'2017-06-12 15:58:28.643',NULL,NULL,NULL,'0134C648-52B2-4D15-80F4-4D23354BF949',0.00,0x000000000105CD4A,'00000000-0000-0000-0000-000000000000');
    INSERT INTO mytable(i_ticket_item_id,i_ticket_id,i_menu_item_id,s_item,dt_when,c_price,c_discount_amount,c_tax_total,i_employee_id,i_cover_id,i_void_item_id,i_held,b_printed,i_split_group,f_split,i_held_for_choice,s_qty,c_ticketitem_choices_amount,c_ticketitem_net_price,f_ticketitem_ticket_discount_factor,i_ticketitem_actual_employee_id,c_ticketitem_tip_share,f_ticketitem_share_qty,f_ticketitem_real_qty,i_ticketitem_timesheet_id,c_ticketitem_gross_price,c_ticketitem_manual_discounts,c_ticketitem_auto_discounts,i_ti_customer_id,i_ti_void_ticket_id,i_ti_customer_orig_id,dt_ti_ticket_close_time,i_ti_revcenter_id,c_hidden_taxes,i_course_id,original_add_time,s_applicable_ticket_discounts,s_applicable_ticket_taxes,s_special_request,g_ticketitem_id,c_autograt_amount,rv_TicketItem,g_combination_guid) VALUES (579167,'130252',580,'Tea & Aloe','2017-06-12 15:58:53.283',3.00,0.00,NULL,154,74642,NULL,0,NULL,1,1,0,1,0.00,3.00,0,154,NULL,1,1,16009,3.00,0.00,0.00,3042,NULL,3042,'2017-06-12 15:58:55.840',2,0.00,0,'2017-06-12 15:58:48.160',NULL,NULL,NULL,'561CB11A-23EE-4036-9FA4-D0E7475EECA6',0.00,0x000000000105CD32,'00000000-0000-0000-0000-000000000000');
    INSERT INTO mytable(i_ticket_item_id,i_ticket_id,i_menu_item_id,s_item,dt_when,c_price,c_discount_amount,c_tax_total,i_employee_id,i_cover_id,i_void_item_id,i_held,b_printed,i_split_group,f_split,i_held_for_choice,s_qty,c_ticketitem_choices_amount,c_ticketitem_net_price,f_ticketitem_ticket_discount_factor,i_ticketitem_actual_employee_id,c_ticketitem_tip_share,f_ticketitem_share_qty,f_ticketitem_real_qty,i_ticketitem_timesheet_id,c_ticketitem_gross_price,c_ticketitem_manual_discounts,c_ticketitem_auto_discounts,i_ti_customer_id,i_ti_void_ticket_id,i_ti_customer_orig_id,dt_ti_ticket_close_time,i_ti_revcenter_id,c_hidden_taxes,i_course_id,original_add_time,s_applicable_ticket_discounts,s_applicable_ticket_taxes,s_special_request,g_ticketitem_id,c_autograt_amount,rv_TicketItem,g_combination_guid) VALUES (579168,'130252',545,'Liftoff','2017-06-12 15:58:53.303',2.00,0.00,NULL,154,74642,NULL,0,NULL,2,1,0,1,0.00,2.00,0,154,NULL,1,1,16009,2.00,0.00,0.00,3042,NULL,3042,'2017-06-12 15:58:55.840',2,0.00,0,'2017-06-12 15:58:51.333',NULL,NULL,NULL,'C13BDF3C-918A-4CA2-945A-21CC37D270A3',0.00,0x000000000105CD33,'00000000-0000-0000-0000-000000000000');
    INSERT INTO mytable(i_ticket_item_id,i_ticket_id,i_menu_item_id,s_item,dt_when,c_price,c_discount_amount,c_tax_total,i_employee_id,i_cover_id,i_void_item_id,i_held,b_printed,i_split_group,f_split,i_held_for_choice,s_qty,c_ticketitem_choices_amount,c_ticketitem_net_price,f_ticketitem_ticket_discount_factor,i_ticketitem_actual_employee_id,c_ticketitem_tip_share,f_ticketitem_share_qty,f_ticketitem_real_qty,i_ticketitem_timesheet_id,c_ticketitem_gross_price,c_ticketitem_manual_discounts,c_ticketitem_auto_discounts,i_ti_customer_id,i_ti_void_ticket_id,i_ti_customer_orig_id,dt_ti_ticket_close_time,i_ti_revcenter_id,c_hidden_taxes,i_course_id,original_add_time,s_applicable_ticket_discounts,s_applicable_ticket_taxes,s_special_request,g_ticketitem_id,c_autograt_amount,rv_TicketItem,g_combination_guid) VALUES (579169,'130253',720,'PL Cafe Latte','2017-06-12 16:03:22.943',8.00,0.00,NULL,133,74643,NULL,0,NULL,1,1,0,1,0.00,8.00,0,133,NULL,1,1,16006,8.00,0.00,0.00,3787,NULL,3787,'2017-06-12 16:03:25.133',2,0.00,0,'2017-06-12 16:03:20.300',NULL,NULL,NULL,'8EEB6E46-A2DE-4757-B36F-817BCAF2D895',0.00,0x000000000105D009,'00000000-0000-0000-0000-000000000000');
    INSERT INTO mytable(i_ticket_item_id,i_ticket_id,i_menu_item_id,s_item,dt_when,c_price,c_discount_amount,c_tax_total,i_employee_id,i_cover_id,i_void_item_id,i_held,b_printed,i_split_group,f_split,i_held_for_choice,s_qty,c_ticketitem_choices_amount,c_ticketitem_net_price,f_ticketitem_ticket_discount_factor,i_ticketitem_actual_employee_id,c_ticketitem_tip_share,f_ticketitem_share_qty,f_ticketitem_real_qty,i_ticketitem_timesheet_id,c_ticketitem_gross_price,c_ticketitem_manual_discounts,c_ticketitem_auto_discounts,i_ti_customer_id,i_ti_void_ticket_id,i_ti_customer_orig_id,dt_ti_ticket_close_time,i_ti_revcenter_id,c_hidden_taxes,i_course_id,original_add_time,s_applicable_ticket_discounts,s_applicable_ticket_taxes,s_special_request,g_ticketitem_id,c_autograt_amount,rv_TicketItem,g_combination_guid) VALUES (579170,'130254',470,'German Chocolate Cake','2017-06-12 16:13:06.217',9.00,0.00,NULL,176,74644,NULL,0,NULL,1,1,0,1,0.00,9.00,0,176,NULL,1,1,16010,9.00,0.00,0.00,3790,NULL,3790,'2017-06-12 16:13:08.727',2,0.00,0,'2017-06-12 16:13:03.563',NULL,NULL,NULL,'6299905E-C3A7-4AA4-98A2-0C1045EB3198',0.00,0x000000000105CE2B,'00000000-0000-0000-0000-000000000000');
    INSERT INTO mytable(i_ticket_item_id,i_ticket_id,i_menu_item_id,s_item,dt_when,c_price,c_discount_amount,c_tax_total,i_employee_id,i_cover_id,i_void_item_id,i_held,b_printed,i_split_group,f_split,i_held_for_choice,s_qty,c_ticketitem_choices_amount,c_ticketitem_net_price,f_ticketitem_ticket_discount_factor,i_ticketitem_actual_employee_id,c_ticketitem_tip_share,f_ticketitem_share_qty,f_ticketitem_real_qty,i_ticketitem_timesheet_id,c_ticketitem_gross_price,c_ticketitem_manual_discounts,c_ticketitem_auto_discounts,i_ti_customer_id,i_ti_void_ticket_id,i_ti_customer_orig_id,dt_ti_ticket_close_time,i_ti_revcenter_id,c_hidden_taxes,i_course_id,original_add_time,s_applicable_ticket_discounts,s_applicable_ticket_taxes,s_special_request,g_ticketitem_id,c_autograt_amount,rv_TicketItem,g_combination_guid) VALUES (579171,'130255',475,'Lemon Poppyseed Muffin','2017-06-12 16:17:03.703',9.00,0.00,NULL,176,74645,NULL,0,NULL,1,1,0,1,0.00,9.00,0,176,NULL,1,1,16010,9.00,0.00,0.00,1369,NULL,1369,'2017-06-12 16:17:12.033',2,0.00,0,'2017-06-12 16:16:06.797',NULL,NULL,NULL,'10523C18-2EF3-49C3-AF20-79F9B4003E27',0.00,0x000000000105CE0D,'00000000-0000-0000-0000-000000000000');
    INSERT INTO mytable(i_ticket_item_id,i_ticket_id,i_menu_item_id,s_item,dt_when,c_price,c_discount_amount,c_tax_total,i_employee_id,i_cover_id,i_void_item_id,i_held,b_printed,i_split_group,f_split,i_held_for_choice,s_qty,c_ticketitem_choices_amount,c_ticketitem_net_price,f_ticketitem_ticket_discount_factor,i_ticketitem_actual_employee_id,c_ticketitem_tip_share,f_ticketitem_share_qty,f_ticketitem_real_qty,i_ticketitem_timesheet_id,c_ticketitem_gross_price,c_ticketitem_manual_discounts,c_ticketitem_auto_discounts,i_ti_customer_id,i_ti_void_ticket_id,i_ti_customer_orig_id,dt_ti_ticket_close_time,i_ti_revcenter_id,c_hidden_taxes,i_course_id,original_add_time,s_applicable_ticket_discounts,s_applicable_ticket_taxes,s_special_request,g_ticketitem_id,c_autograt_amount,rv_TicketItem,g_combination_guid) VALUES (579172,'130255',545,'Liftoff','2017-06-12 16:17:03.740',2.00,0.00,NULL,176,74645,NULL,0,NULL,2,1,0,1,0.00,2.00,0,176,NULL,1,1,16010,2.00,0.00,0.00,1369,NULL,1369,'2017-06-12 16:17:12.033',2,0.00,0,'2017-06-12 16:16:20.827',NULL,NULL,NULL,'3FD1C678-DA0E-4E08-A167-AF6639B113C5',0.00,0x000000000105CE0E,'00000000-0000-0000-0000-000000000000');
    INSERT INTO mytable(i_ticket_item_id,i_ticket_id,i_menu_item_id,s_item,dt_when,c_price,c_discount_amount,c_tax_total,i_employee_id,i_cover_id,i_void_item_id,i_held,b_printed,i_split_group,f_split,i_held_for_choice,s_qty,c_ticketitem_choices_amount,c_ticketitem_net_price,f_ticketitem_ticket_discount_factor,i_ticketitem_actual_employee_id,c_ticketitem_tip_share,f_ticketitem_share_qty,f_ticketitem_real_qty,i_ticketitem_timesheet_id,c_ticketitem_gross_price,c_ticketitem_manual_discounts,c_ticketitem_auto_discounts,i_ti_customer_id,i_ti_void_ticket_id,i_ti_customer_orig_id,dt_ti_ticket_close_time,i_ti_revcenter_id,c_hidden_taxes,i_course_id,original_add_time,s_applicable_ticket_discounts,s_applicable_ticket_taxes,s_special_request,g_ticketitem_id,c_autograt_amount,rv_TicketItem,g_combination_guid) VALUES (579173,'130255',465,'Dolce & Gabanna','2017-06-12 16:17:03.753',9.00,0.00,NULL,176,74645,NULL,0,NULL,3,1,0,1,0.00,9.00,0,176,NULL,1,1,16010,9.00,0.00,0.00,1369,NULL,1369,'2017-06-12 16:17:12.033',2,0.00,0,'2017-06-12 16:16:52.343',NULL,NULL,NULL,'646C43AB-865C-47F6-B595-D27A754790B9',0.00,0x000000000105CE0F,'00000000-0000-0000-0000-000000000000');
    INSERT INTO mytable(i_ticket_item_id,i_ticket_id,i_menu_item_id,s_item,dt_when,c_price,c_discount_amount,c_tax_total,i_employee_id,i_cover_id,i_void_item_id,i_held,b_printed,i_split_group,f_split,i_held_for_choice,s_qty,c_ticketitem_choices_amount,c_ticketitem_net_price,f_ticketitem_ticket_discount_factor,i_ticketitem_actual_employee_id,c_ticketitem_tip_share,f_ticketitem_share_qty,f_ticketitem_real_qty,i_ticketitem_timesheet_id,c_ticketitem_gross_price,c_ticketitem_manual_discounts,c_ticketitem_auto_discounts,i_ti_customer_id,i_ti_void_ticket_id,i_ti_customer_orig_id,dt_ti_ticket_close_time,i_ti_revcenter_id,c_hidden_taxes,i_course_id,original_add_time,s_applicable_ticket_discounts,s_applicable_ticket_taxes,s_special_request,g_ticketitem_id,c_autograt_amount,rv_TicketItem,g_combination_guid) VALUES (579174,'130256',505,'Samoas','2017-06-13 09:00:30.330',9.00,0.00,NULL,1,74646,NULL,0,NULL,1,1,0,1,0.00,9.00,0,1,NULL,1,1,16014,9.00,0.00,0.00,3887,NULL,3887,'2017-06-13 09:00:33.923',2,0.00,0,'2017-06-13 09:00:24.520',NULL,NULL,NULL,'0A056508-25BF-4A28-BBDD-400AD5FF74CC',0.00,0x000000000105DCEC,'00000000-0000-0000-0000-000000000000');
    INSERT INTO mytable(i_ticket_item_id,i_ticket_id,i_menu_item_id,s_item,dt_when,c_price,c_discount_amount,c_tax_total,i_employee_id,i_cover_id,i_void_item_id,i_held,b_printed,i_split_group,f_split,i_held_for_choice,s_qty,c_ticketitem_choices_amount,c_ticketitem_net_price,f_ticketitem_ticket_discount_factor,i_ticketitem_actual_employee_id,c_ticketitem_tip_share,f_ticketitem_share_qty,f_ticketitem_real_qty,i_ticketitem_timesheet_id,c_ticketitem_gross_price,c_ticketitem_manual_discounts,c_ticketitem_auto_discounts,i_ti_customer_id,i_ti_void_ticket_id,i_ti_customer_orig_id,dt_ti_ticket_close_time,i_ti_revcenter_id,c_hidden_taxes,i_course_id,original_add_time,s_applicable_ticket_discounts,s_applicable_ticket_taxes,s_special_request,g_ticketitem_id,c_autograt_amount,rv_TicketItem,g_combination_guid) VALUES (579175,'130257',505,'Samoas','2017-06-13 09:00:52.890',9.00,0.00,NULL,1,74647,NULL,0,NULL,1,1,0,1,0.00,9.00,0,1,NULL,1,1,16014,9.00,0.00,0.00,0,NULL,NULL,'2017-06-13 09:00:54.213',2,0.00,0,'2017-06-13 09:00:48.763',NULL,NULL,NULL,'62F4D307-F115-4504-8E9C-6E06E345827F',0.00,0x000000000105DCEB,'00000000-0000-0000-0000-000000000000');
    INSERT INTO mytable(i_ticket_item_id,i_ticket_id,i_menu_item_id,s_item,dt_when,c_price,c_discount_amount,c_tax_total,i_employee_id,i_cover_id,i_void_item_id,i_held,b_printed,i_split_group,f_split,i_held_for_choice,s_qty,c_ticketitem_choices_amount,c_ticketitem_net_price,f_ticketitem_ticket_discount_factor,i_ticketitem_actual_employee_id,c_ticketitem_tip_share,f_ticketitem_share_qty,f_ticketitem_real_qty,i_ticketitem_timesheet_id,c_ticketitem_gross_price,c_ticketitem_manual_discounts,c_ticketitem_auto_discounts,i_ti_customer_id,i_ti_void_ticket_id,i_ti_customer_orig_id,dt_ti_ticket_close_time,i_ti_revcenter_id,c_hidden_taxes,i_course_id,original_add_time,s_applicable_ticket_discounts,s_applicable_ticket_taxes,s_special_request,g_ticketitem_id,c_autograt_amount,rv_TicketItem,g_combination_guid) VALUES (579176,'130258',541,'Orange H3O','2017-06-13 09:37:39.780',2.00,0.00,NULL,1,74648,NULL,0,NULL,1,1,0,1,0.00,2.00,0,1,NULL,1,1,16014,2.00,0.00,0.00,3887,NULL,3887,'2017-06-13 09:37:41.190',2,0.00,0,'2017-06-13 09:37:17.580',NULL,NULL,NULL,'F0CAACA7-D47F-4536-9F4C-6A4FD53F8696',0.00,0x000000000105DCE9,'00000000-0000-0000-0000-000000000000');
    INSERT INTO mytable(i_ticket_item_id,i_ticket_id,i_menu_item_id,s_item,dt_when,c_price,c_discount_amount,c_tax_total,i_employee_id,i_cover_id,i_void_item_id,i_held,b_printed,i_split_group,f_split,i_held_for_choice,s_qty,c_ticketitem_choices_amount,c_ticketitem_net_price,f_ticketitem_ticket_discount_factor,i_ticketitem_actual_employee_id,c_ticketitem_tip_share,f_ticketitem_share_qty,f_ticketitem_real_qty,i_ticketitem_timesheet_id,c_ticketitem_gross_price,c_ticketitem_manual_discounts,c_ticketitem_auto_discounts,i_ti_customer_id,i_ti_void_ticket_id,i_ti_customer_orig_id,dt_ti_ticket_close_time,i_ti_revcenter_id,c_hidden_taxes,i_course_id,original_add_time,s_applicable_ticket_discounts,s_applicable_ticket_taxes,s_special_request,g_ticketitem_id,c_autograt_amount,rv_TicketItem,g_combination_guid) VALUES (579177,'130258',541,'Orange H3O','2017-06-13 09:37:39.787',2.00,0.00,NULL,1,74648,NULL,0,NULL,2,1,0,1,0.00,2.00,0,1,NULL,1,1,16014,2.00,0.00,0.00,3887,NULL,3887,'2017-06-13 09:37:41.190',2,0.00,0,'2017-06-13 09:37:18.153',NULL,NULL,NULL,'DB44E614-1487-4E2C-8787-E9AEAFE9CD1F',0.00,0x000000000105DCEA,'00000000-0000-0000-0000-000000000000');
    INSERT INTO mytable(i_ticket_item_id,i_ticket_id,i_menu_item_id,s_item,dt_when,c_price,c_discount_amount,c_tax_total,i_employee_id,i_cover_id,i_void_item_id,i_held,b_printed,i_split_group,f_split,i_held_for_choice,s_qty,c_ticketitem_choices_amount,c_ticketitem_net_price,f_ticketitem_ticket_discount_factor,i_ticketitem_actual_employee_id,c_ticketitem_tip_share,f_ticketitem_share_qty,f_ticketitem_real_qty,i_ticketitem_timesheet_id,c_ticketitem_gross_price,c_ticketitem_manual_discounts,c_ticketitem_auto_discounts,i_ti_customer_id,i_ti_void_ticket_id,i_ti_customer_orig_id,dt_ti_ticket_close_time,i_ti_revcenter_id,c_hidden_taxes,i_course_id,original_add_time,s_applicable_ticket_discounts,s_applicable_ticket_taxes,s_special_request,g_ticketitem_id,c_autograt_amount,rv_TicketItem,g_combination_guid) VALUES (579178,'130259',541,'Orange H3O','2017-06-13 09:43:55.640',2.00,0.00,NULL,1,74649,NULL,0,NULL,1,1,0,1,0.00,2.00,0,1,NULL,1,1,16014,2.00,0.00,0.00,3887,NULL,3887,'2017-06-13 09:43:57.067',2,0.00,0,'2017-06-13 09:43:41.653',NULL,NULL,NULL,'EFCABCDE-3579-47E1-99B3-6078A192BE2C',0.00,0x000000000105DCE8,'00000000-0000-0000-0000-000000000000');
    INSERT INTO mytable(i_ticket_item_id,i_ticket_id,i_menu_item_id,s_item,dt_when,c_price,c_discount_amount,c_tax_total,i_employee_id,i_cover_id,i_void_item_id,i_held,b_printed,i_split_group,f_split,i_held_for_choice,s_qty,c_ticketitem_choices_amount,c_ticketitem_net_price,f_ticketitem_ticket_discount_factor,i_ticketitem_actual_employee_id,c_ticketitem_tip_share,f_ticketitem_share_qty,f_ticketitem_real_qty,i_ticketitem_timesheet_id,c_ticketitem_gross_price,c_ticketitem_manual_discounts,c_ticketitem_auto_discounts,i_ti_customer_id,i_ti_void_ticket_id,i_ti_customer_orig_id,dt_ti_ticket_close_time,i_ti_revcenter_id,c_hidden_taxes,i_course_id,original_add_time,s_applicable_ticket_discounts,s_applicable_ticket_taxes,s_special_request,g_ticketitem_id,c_autograt_amount,rv_TicketItem,g_combination_guid) VALUES (579179,'130260',438,'Bananas Foster','2017-06-14 08:51:59.920',9.00,0.00,NULL,179,74650,NULL,0,NULL,1,1,0,1,0.00,9.00,0,179,NULL,1,1,16051,9.00,0.00,0.00,0,NULL,NULL,'2017-06-14 08:52:01.790',0,0.00,0,'2017-06-14 08:51:58.370',NULL,NULL,NULL,'8A02A033-D03E-4F87-96F4-67C6E0661837',0.00,0x000000000105E7AC,'00000000-0000-0000-0000-000000000000');
    INSERT INTO mytable(i_ticket_item_id,i_ticket_id,i_menu_item_id,s_item,dt_when,c_price,c_discount_amount,c_tax_total,i_employee_id,i_cover_id,i_void_item_id,i_held,b_printed,i_split_group,f_split,i_held_for_choice,s_qty,c_ticketitem_choices_amount,c_ticketitem_net_price,f_ticketitem_ticket_discount_factor,i_ticketitem_actual_employee_id,c_ticketitem_tip_share,f_ticketitem_share_qty,f_ticketitem_real_qty,i_ticketitem_timesheet_id,c_ticketitem_gross_price,c_ticketitem_manual_discounts,c_ticketitem_auto_discounts,i_ti_customer_id,i_ti_void_ticket_id,i_ti_customer_orig_id,dt_ti_ticket_close_time,i_ti_revcenter_id,c_hidden_taxes,i_course_id,original_add_time,s_applicable_ticket_discounts,s_applicable_ticket_taxes,s_special_request,g_ticketitem_id,c_autograt_amount,rv_TicketItem,g_combination_guid) VALUES (579180,'130260',438,'Bananas Foster','2017-06-14 08:51:59.960',9.00,0.00,NULL,179,74650,NULL,0,NULL,2,1,0,1,0.00,9.00,0,179,NULL,1,1,16051,9.00,0.00,0.00,0,NULL,NULL,'2017-06-14 08:52:01.790',0,0.00,0,'2017-06-14 08:51:58.500',NULL,NULL,NULL,'E41D3E5B-4EAF-4515-BC3F-BCEC4D140FA6',0.00,0x000000000105E7AD,'00000000-0000-0000-0000-000000000000');
    INSERT INTO mytable(i_ticket_item_id,i_ticket_id,i_menu_item_id,s_item,dt_when,c_price,c_discount_amount,c_tax_total,i_employee_id,i_cover_id,i_void_item_id,i_held,b_printed,i_split_group,f_split,i_held_for_choice,s_qty,c_ticketitem_choices_amount,c_ticketitem_net_price,f_ticketitem_ticket_discount_factor,i_ticketitem_actual_employee_id,c_ticketitem_tip_share,f_ticketitem_share_qty,f_ticketitem_real_qty,i_ticketitem_timesheet_id,c_ticketitem_gross_price,c_ticketitem_manual_discounts,c_ticketitem_auto_discounts,i_ti_customer_id,i_ti_void_ticket_id,i_ti_customer_orig_id,dt_ti_ticket_close_time,i_ti_revcenter_id,c_hidden_taxes,i_course_id,original_add_time,s_applicable_ticket_discounts,s_applicable_ticket_taxes,s_special_request,g_ticketitem_id,c_autograt_amount,rv_TicketItem,g_combination_guid) VALUES (579181,'130260',438,'Bananas Foster','2017-06-14 08:51:59.963',9.00,0.00,NULL,179,74650,NULL,0,NULL,3,1,0,1,0.00,9.00,0,179,NULL,1,1,16051,9.00,0.00,0.00,0,NULL,NULL,'2017-06-14 08:52:01.790',0,0.00,0,'2017-06-14 08:51:58.617',NULL,NULL,NULL,'BA616DB3-A481-44D8-BBA6-647DFF56D944',0.00,0x000000000105E7AE,'00000000-0000-0000-0000-000000000000');
    INSERT INTO mytable(i_ticket_item_id,i_ticket_id,i_menu_item_id,s_item,dt_when,c_price,c_discount_amount,c_tax_total,i_employee_id,i_cover_id,i_void_item_id,i_held,b_printed,i_split_group,f_split,i_held_for_choice,s_qty,c_ticketitem_choices_amount,c_ticketitem_net_price,f_ticketitem_ticket_discount_factor,i_ticketitem_actual_employee_id,c_ticketitem_tip_share,f_ticketitem_share_qty,f_ticketitem_real_qty,i_ticketitem_timesheet_id,c_ticketitem_gross_price,c_ticketitem_manual_discounts,c_ticketitem_auto_discounts,i_ti_customer_id,i_ti_void_ticket_id,i_ti_customer_orig_id,dt_ti_ticket_close_time,i_ti_revcenter_id,c_hidden_taxes,i_course_id,original_add_time,s_applicable_ticket_discounts,s_applicable_ticket_taxes,s_special_request,g_ticketitem_id,c_autograt_amount,rv_TicketItem,g_combination_guid) VALUES (579182,'130260',438,'Bananas Foster','2017-06-14 08:51:59.967',9.00,0.00,NULL,179,74650,NULL,0,NULL,4,1,0,1,0.00,9.00,0,179,NULL,1,1,16051,9.00,0.00,0.00,0,NULL,NULL,'2017-06-14 08:52:01.790',0,0.00,0,'2017-06-14 08:51:58.787',NULL,NULL,NULL,'797B0149-C149-4865-A05B-21BCC4017B87',0.00,0x000000000105E7AF,'00000000-0000-0000-0000-000000000000');
    INSERT INTO mytable(i_ticket_item_id,i_ticket_id,i_menu_item_id,s_item,dt_when,c_price,c_discount_amount,c_tax_total,i_employee_id,i_cover_id,i_void_item_id,i_held,b_printed,i_split_group,f_split,i_held_for_choice,s_qty,c_ticketitem_choices_amount,c_ticketitem_net_price,f_ticketitem_ticket_discount_factor,i_ticketitem_actual_employee_id,c_ticketitem_tip_share,f_ticketitem_share_qty,f_ticketitem_real_qty,i_ticketitem_timesheet_id,c_ticketitem_gross_price,c_ticketitem_manual_discounts,c_ticketitem_auto_discounts,i_ti_customer_id,i_ti_void_ticket_id,i_ti_customer_orig_id,dt_ti_ticket_close_time,i_ti_revcenter_id,c_hidden_taxes,i_course_id,original_add_time,s_applicable_ticket_discounts,s_applicable_ticket_taxes,s_special_request,g_ticketitem_id,c_autograt_amount,rv_TicketItem,g_combination_guid) VALUES (579183,'130260',438,'Bananas Foster','2017-06-14 08:51:59.967',9.00,0.00,NULL,179,74650,NULL,0,NULL,5,1,0,1,0.00,9.00,0,179,NULL,1,1,16051,9.00,0.00,0.00,0,NULL,NULL,'2017-06-14 08:52:01.790',0,0.00,0,'2017-06-14 08:51:58.947',NULL,NULL,NULL,'CD9D76EA-41AE-4E89-AEC2-1E6EAFDE539C',0.00,0x000000000105E7B0,'00000000-0000-0000-0000-000000000000');

    CREATE TABLE ChoiceItem(
     i_choice_item_id     INTEGER NOT NULL PRIMARY KEY
    ,i_choice_id      INTEGER NOT NULL
    ,i_ticket_item_id     INTEGER NOT NULL
    ,i_employee_id      INTEGER NOT NULL
    ,dt_when        VARCHAR(23) NOT NULL
    ,s_choice_name      VARCHAR(19) NOT NULL
    ,m_choice_price_mod    NUMERIC(4,2) NOT NULL
    ,m_choiceitem_price    NUMERIC(4,2) NOT NULL
    ,i_choiceitem_timesheet_id  VARCHAR(4)
    ,i_choiceitem_parent_cci_id INTEGER NOT NULL
    ,i_choiceitem_ordinal   BIT NOT NULL
    ,i_choiceitem_cc_id    BIT NOT NULL
    ,dt_added       VARCHAR(23) NOT NULL
    ,m_ci_quantity      NUMERIC(4,2) NOT NULL
    ,m_ci_original_quantity   NUMERIC(4,2) NOT NULL
    ,rv_ChoiceItem      INTEGER NOT NULL
    ,g_ChoiceItem_id     VARCHAR(36) NOT NULL
    ,m_ci_original_share_quantity BIT NOT NULL
    );
    INSERT INTO mytable(i_choice_item_id,i_choice_id,i_ticket_item_id,i_employee_id,dt_when,s_choice_name,m_choice_price_mod,m_choiceitem_price,i_choiceitem_timesheet_id,i_choiceitem_parent_cci_id,i_choiceitem_ordinal,i_choiceitem_cc_id,dt_added,m_ci_quantity,m_ci_original_quantity,rv_ChoiceItem,g_ChoiceItem_id,m_ci_original_share_quantity) VALUES (162929,122,579167,154,'2017-06-12 15:58:53.290','Lemon Tea Hot',0.00,0.00,NULL,369288,1,0,'2017-06-12 15:58:48.943',1.00,1.00,0x000000000105C543,'0925B2E6-20D1-4C41-A0E2-DFFC66F3FB7F',1);
    INSERT INTO mytable(i_choice_item_id,i_choice_id,i_ticket_item_id,i_employee_id,dt_when,s_choice_name,m_choice_price_mod,m_choiceitem_price,i_choiceitem_timesheet_id,i_choiceitem_parent_cci_id,i_choiceitem_ordinal,i_choiceitem_cc_id,dt_added,m_ci_quantity,m_ci_original_quantity,rv_ChoiceItem,g_ChoiceItem_id,m_ci_original_share_quantity) VALUES (162930,119,579167,154,'2017-06-12 15:58:53.290','Cranberry Aloe Shot',0.00,0.00,NULL,369289,1,0,'2017-06-12 15:58:49.800',1.00,1.00,0x000000000105C545,'F815441D-1B71-48B1-8DED-22721A6526E2',1);
    INSERT INTO mytable(i_choice_item_id,i_choice_id,i_ticket_item_id,i_employee_id,dt_when,s_choice_name,m_choice_price_mod,m_choiceitem_price,i_choiceitem_timesheet_id,i_choiceitem_parent_cci_id,i_choiceitem_ordinal,i_choiceitem_cc_id,dt_added,m_ci_quantity,m_ci_original_quantity,rv_ChoiceItem,g_ChoiceItem_id,m_ci_original_share_quantity) VALUES (162931,145,579168,154,'2017-06-12 15:58:53.307','Pomegrante Liftoff',0.00,0.00,NULL,369290,1,0,'2017-06-12 15:58:52.223',1.00,1.00,0x000000000105C54B,'7057F65F-5CEA-4D9B-A80C-0C51F16104D9',1);
    INSERT INTO mytable(i_choice_item_id,i_choice_id,i_ticket_item_id,i_employee_id,dt_when,s_choice_name,m_choice_price_mod,m_choiceitem_price,i_choiceitem_timesheet_id,i_choiceitem_parent_cci_id,i_choiceitem_ordinal,i_choiceitem_cc_id,dt_added,m_ci_quantity,m_ci_original_quantity,rv_ChoiceItem,g_ChoiceItem_id,m_ci_original_share_quantity) VALUES (162932,130,579169,133,'2017-06-12 16:03:22.950','Lemon Tea Cold',0.00,0.00,NULL,369291,1,0,'2017-06-12 16:03:21.690',1.00,1.00,0x000000000105C602,'CAD1BC6B-D22D-4CAF-9488-BD64A1B506C2',1);
    INSERT INTO mytable(i_choice_item_id,i_choice_id,i_ticket_item_id,i_employee_id,dt_when,s_choice_name,m_choice_price_mod,m_choiceitem_price,i_choiceitem_timesheet_id,i_choiceitem_parent_cci_id,i_choiceitem_ordinal,i_choiceitem_cc_id,dt_added,m_ci_quantity,m_ci_original_quantity,rv_ChoiceItem,g_ChoiceItem_id,m_ci_original_share_quantity) VALUES (162933,120,579169,133,'2017-06-12 16:03:22.953','Mango Aloe Shot',0.00,0.00,NULL,369292,1,0,'2017-06-12 16:03:22.190',1.00,1.00,0x000000000105C604,'AEB453D3-4B14-44EB-B2EE-9334AA828CE4',1);
    INSERT INTO mytable(i_choice_item_id,i_choice_id,i_ticket_item_id,i_employee_id,dt_when,s_choice_name,m_choice_price_mod,m_choiceitem_price,i_choiceitem_timesheet_id,i_choiceitem_parent_cci_id,i_choiceitem_ordinal,i_choiceitem_cc_id,dt_added,m_ci_quantity,m_ci_original_quantity,rv_ChoiceItem,g_ChoiceItem_id,m_ci_original_share_quantity) VALUES (162934,130,579170,176,'2017-06-12 16:13:06.223','Lemon Tea Cold',0.00,0.00,NULL,369296,1,0,'2017-06-12 16:13:04.827',1.00,1.00,0x000000000105C7AF,'2EB08907-3314-4EF2-992B-5B1E66DDF587',1);
    INSERT INTO mytable(i_choice_item_id,i_choice_id,i_ticket_item_id,i_employee_id,dt_when,s_choice_name,m_choice_price_mod,m_choiceitem_price,i_choiceitem_timesheet_id,i_choiceitem_parent_cci_id,i_choiceitem_ordinal,i_choiceitem_cc_id,dt_added,m_ci_quantity,m_ci_original_quantity,rv_ChoiceItem,g_ChoiceItem_id,m_ci_original_share_quantity) VALUES (162935,120,579170,176,'2017-06-12 16:13:06.227','Mango Aloe Shot',0.00,0.00,NULL,369297,1,0,'2017-06-12 16:13:05.360',1.00,1.00,0x000000000105C7B1,'66C93094-4FC1-4EC9-B302-0421B7504C51',1);
    INSERT INTO mytable(i_choice_item_id,i_choice_id,i_ticket_item_id,i_employee_id,dt_when,s_choice_name,m_choice_price_mod,m_choiceitem_price,i_choiceitem_timesheet_id,i_choiceitem_parent_cci_id,i_choiceitem_ordinal,i_choiceitem_cc_id,dt_added,m_ci_quantity,m_ci_original_quantity,rv_ChoiceItem,g_ChoiceItem_id,m_ci_original_share_quantity) VALUES (162936,130,579171,176,'2017-06-12 16:17:03.710','Lemon Tea Cold',0.00,0.00,NULL,369301,1,0,'2017-06-12 16:16:10.530',1.00,1.00,0x000000000105C873,'DEF135BE-B548-447D-8C11-78435A6C85C7',1);
    INSERT INTO mytable(i_choice_item_id,i_choice_id,i_ticket_item_id,i_employee_id,dt_when,s_choice_name,m_choice_price_mod,m_choiceitem_price,i_choiceitem_timesheet_id,i_choiceitem_parent_cci_id,i_choiceitem_ordinal,i_choiceitem_cc_id,dt_added,m_ci_quantity,m_ci_original_quantity,rv_ChoiceItem,g_ChoiceItem_id,m_ci_original_share_quantity) VALUES (162937,119,579171,176,'2017-06-12 16:17:03.710','Cranberry Aloe Shot',0.00,0.00,NULL,369302,1,0,'2017-06-12 16:16:11.420',1.00,1.00,0x000000000105C875,'A80E5B07-F928-4CCA-BEA4-D857C6A2B135',1);
    INSERT INTO mytable(i_choice_item_id,i_choice_id,i_ticket_item_id,i_employee_id,dt_when,s_choice_name,m_choice_price_mod,m_choiceitem_price,i_choiceitem_timesheet_id,i_choiceitem_parent_cci_id,i_choiceitem_ordinal,i_choiceitem_cc_id,dt_added,m_ci_quantity,m_ci_original_quantity,rv_ChoiceItem,g_ChoiceItem_id,m_ci_original_share_quantity) VALUES (162938,145,579172,176,'2017-06-12 16:17:03.743','Pomegrante Liftoff',0.00,0.00,NULL,369306,1,0,'2017-06-12 16:16:22.403',1.00,1.00,0x000000000105C87E,'7E268514-AE20-4FA2-8ADE-C5C5867CC22E',1);
    INSERT INTO mytable(i_choice_item_id,i_choice_id,i_ticket_item_id,i_employee_id,dt_when,s_choice_name,m_choice_price_mod,m_choiceitem_price,i_choiceitem_timesheet_id,i_choiceitem_parent_cci_id,i_choiceitem_ordinal,i_choiceitem_cc_id,dt_added,m_ci_quantity,m_ci_original_quantity,rv_ChoiceItem,g_ChoiceItem_id,m_ci_original_share_quantity) VALUES (162939,125,579174,1,'2017-06-13 09:00:30.350','Cinnamon Tea Hot',0.00,0.00,NULL,369312,1,0,'2017-06-13 09:00:26.283',1.00,1.00,0x000000000105D798,'3BB416AC-7549-4606-BA4A-53BD3D32096C',1);
    INSERT INTO mytable(i_choice_item_id,i_choice_id,i_ticket_item_id,i_employee_id,dt_when,s_choice_name,m_choice_price_mod,m_choiceitem_price,i_choiceitem_timesheet_id,i_choiceitem_parent_cci_id,i_choiceitem_ordinal,i_choiceitem_cc_id,dt_added,m_ci_quantity,m_ci_original_quantity,rv_ChoiceItem,g_ChoiceItem_id,m_ci_original_share_quantity) VALUES (162940,118,579174,1,'2017-06-13 09:00:30.353','Whey/Casein Protein',0.00,0.00,NULL,369314,1,0,'2017-06-13 09:00:27.713',1.00,1.00,0x000000000105D79B,'9EF1D9AC-33FC-499A-AA8E-47169C703C5B',1);
    INSERT INTO mytable(i_choice_item_id,i_choice_id,i_ticket_item_id,i_employee_id,dt_when,s_choice_name,m_choice_price_mod,m_choiceitem_price,i_choiceitem_timesheet_id,i_choiceitem_parent_cci_id,i_choiceitem_ordinal,i_choiceitem_cc_id,dt_added,m_ci_quantity,m_ci_original_quantity,rv_ChoiceItem,g_ChoiceItem_id,m_ci_original_share_quantity) VALUES (162941,133,579175,1,'2017-06-13 09:00:52.890','Cinnamon Tea Cold',0.00,0.00,NULL,369317,1,0,'2017-06-13 09:00:50.863',1.00,1.00,0x000000000105D824,'EA7D4528-BACA-4E4F-B757-3F016C724174',1);
    INSERT INTO mytable(i_choice_item_id,i_choice_id,i_ticket_item_id,i_employee_id,dt_when,s_choice_name,m_choice_price_mod,m_choiceitem_price,i_choiceitem_timesheet_id,i_choiceitem_parent_cci_id,i_choiceitem_ordinal,i_choiceitem_cc_id,dt_added,m_ci_quantity,m_ci_original_quantity,rv_ChoiceItem,g_ChoiceItem_id,m_ci_original_share_quantity) VALUES (162942,119,579175,1,'2017-06-13 09:00:52.893','Cranberry Aloe Shot',0.00,0.00,NULL,369318,1,0,'2017-06-13 09:00:51.600',1.00,1.00,0x000000000105D826,'BF1BD6E0-7F21-4FD3-9957-B1B3D7B108C6',1);
    INSERT INTO mytable(i_choice_item_id,i_choice_id,i_ticket_item_id,i_employee_id,dt_when,s_choice_name,m_choice_price_mod,m_choiceitem_price,i_choiceitem_timesheet_id,i_choiceitem_parent_cci_id,i_choiceitem_ordinal,i_choiceitem_cc_id,dt_added,m_ci_quantity,m_ci_original_quantity,rv_ChoiceItem,g_ChoiceItem_id,m_ci_original_share_quantity) VALUES (162943,133,579178,1,'2017-06-13 09:43:55.643','Cinnamon Tea Cold',0.00,0.00,NULL,369322,1,0,'2017-06-13 09:43:42.727',1.00,1.00,0x000000000105DBFA,'4657E85B-4588-4F79-B77D-E38089AFE9E6',1);

    CREATE TABLE Customers(
     i_employee_id       INTEGER NOT NULL PRIMARY KEY
    ,s_name         VARCHAR2(17) NOT NULL
    ,s_login         INTEGER NOT NULL
    ,b_active         BIT NOT NULL
    ,b_admin         BIT NOT NULL
    ,b_is_clocked_in      BIT NOT NULL
    ,b_is_logged_in       BIT NOT NULL
    ,dt_clock_in        VARCHAR2(23)
    ,dt_expected_clock_out    VARCHAR(4)
    ,i_employ_id        BIT NOT NULL
    ,s_phone1         VARCHAR(30)
    ,s_phone2         VARCHAR(30)
    ,s_emerg_phone       VARCHAR(30)
    ,s_SSN          VARCHAR(30)
    ,dt_hire         VARCHAR(23) NOT NULL
    ,dt_term         VARCHAR(23) NOT NULL
    ,dt_review        VARCHAR(23) NOT NULL
    ,dt_birth         VARCHAR(23) NOT NULL
    ,s_first         VARCHAR(30)
    ,s_middle         VARCHAR(30)
    ,s_last         VARCHAR(30)
    ,s_street         VARCHAR(30)
    ,s_street2        VARCHAR(30)
    ,s_city         VARCHAR(30)
    ,s_state         VARCHAR(30)
    ,s_postal         VARCHAR(30)
    ,s_email         VARCHAR(30)
    ,s_employee_cardswipe     VARCHAR(30)
    ,i_employee_ordinal     INTEGER NOT NULL
    ,i_employees_current_timesheet_id INTEGER NOT NULL
    ,i_employee_ticketlist_schema  INTEGER NOT NULL
    ,dt_employee_liquor_card_exp_date VARCHAR(23) NOT NULL
    ,dt_employee_health_card_exp_date VARCHAR(23) NOT NULL
    ,s_employee_payroll_id    VARCHAR(30)
    ,s_password_hash      VARCHAR(4)
    ,s_password_salt      VARCHAR(4)
    ,dt_password_changed     VARCHAR(4)
    ,i_authentication_failures   VARCHAR(4)
    ,dt_lockout        VARCHAR(4)
    ,i_security_template_id    INTEGER NOT NULL
    ,rv_Employees       INTEGER NOT NULL
    ,g_Employees_id       VARCHAR(36) NOT NULL
    ,i_external_id       VARCHAR(4)
    );
    INSERT INTO mytable(i_employee_id,s_name,s_login,b_active,b_admin,b_is_clocked_in,b_is_logged_in,dt_clock_in,dt_expected_clock_out,i_employ_id,s_phone1,s_phone2,s_emerg_phone,s_SSN,dt_hire,dt_term,dt_review,dt_birth,s_first,s_middle,s_last,s_street,s_street2,s_city,s_state,s_postal,s_email,s_employee_cardswipe,i_employee_ordinal,i_employees_current_timesheet_id,i_employee_ticketlist_schema,dt_employee_liquor_card_exp_date,dt_employee_health_card_exp_date,s_employee_payroll_id,s_password_hash,s_password_salt,dt_password_changed,i_authentication_failures,dt_lockout,i_security_template_id,rv_Employees,g_Employees_id,i_external_id) VALUES (132,'Hannah Snow',1992,1,0,1,0,'2016-11-16 13:30:30.727',NULL,0,NULL,NULL,NULL,NULL,'1753-01-01 00:00:00.000','1753-01-01 00:00:00.000','1753-01-01 00:00:00.000','1753-01-01 00:00:00.000',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8,16035,3358,'1753-01-01 00:00:00.000','1753-01-01 00:00:00.000',NULL,NULL,NULL,NULL,NULL,NULL,3,0x000000000105E659,'7EB4D5C4-2069-4698-AFF7-D9A88C0B6292',NULL);
    INSERT INTO mytable(i_employee_id,s_name,s_login,b_active,b_admin,b_is_clocked_in,b_is_logged_in,dt_clock_in,dt_expected_clock_out,i_employ_id,s_phone1,s_phone2,s_emerg_phone,s_SSN,dt_hire,dt_term,dt_review,dt_birth,s_first,s_middle,s_last,s_street,s_street2,s_city,s_state,s_postal,s_email,s_employee_cardswipe,i_employee_ordinal,i_employees_current_timesheet_id,i_employee_ticketlist_schema,dt_employee_liquor_card_exp_date,dt_employee_health_card_exp_date,s_employee_payroll_id,s_password_hash,s_password_salt,dt_password_changed,i_authentication_failures,dt_lockout,i_security_template_id,rv_Employees,g_Employees_id,i_external_id) VALUES (133,'Mackenzie Reed',1998,1,0,0,0,NULL,NULL,0,NULL,NULL,NULL,NULL,'1753-01-01 00:00:00.000','1753-01-01 00:00:00.000','1753-01-01 00:00:00.000','1753-01-01 00:00:00.000',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13,16006,16966,'1753-01-01 00:00:00.000','1753-01-01 00:00:00.000',NULL,NULL,NULL,NULL,NULL,NULL,4,0x000000000105E65E,'97434887-3118-4609-8D19-1645192BE838',NULL);
    INSERT INTO mytable(i_employee_id,s_name,s_login,b_active,b_admin,b_is_clocked_in,b_is_logged_in,dt_clock_in,dt_expected_clock_out,i_employ_id,s_phone1,s_phone2,s_emerg_phone,s_SSN,dt_hire,dt_term,dt_review,dt_birth,s_first,s_middle,s_last,s_street,s_street2,s_city,s_state,s_postal,s_email,s_employee_cardswipe,i_employee_ordinal,i_employees_current_timesheet_id,i_employee_ticketlist_schema,dt_employee_liquor_card_exp_date,dt_employee_health_card_exp_date,s_employee_payroll_id,s_password_hash,s_password_salt,dt_password_changed,i_authentication_failures,dt_lockout,i_security_template_id,rv_Employees,g_Employees_id,i_external_id) VALUES (147,'Erica Archambault',0702,1,0,1,0,'2017-04-18 16:18:14.447',NULL,0,NULL,NULL,NULL,NULL,'1753-01-01 00:00:00.000','1753-01-01 00:00:00.000','1753-01-01 00:00:00.000','1753-01-01 00:00:00.000',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7,16043,24354,'1753-01-01 00:00:00.000','1753-01-01 00:00:00.000',NULL,NULL,NULL,NULL,NULL,NULL,3,0x000000000105E658,'10207DA7-A24E-4D33-AC17-74C3FD8E2B6F',NULL);
    INSERT INTO mytable(i_employee_id,s_name,s_login,b_active,b_admin,b_is_clocked_in,b_is_logged_in,dt_clock_in,dt_expected_clock_out,i_employ_id,s_phone1,s_phone2,s_emerg_phone,s_SSN,dt_hire,dt_term,dt_review,dt_birth,s_first,s_middle,s_last,s_street,s_street2,s_city,s_state,s_postal,s_email,s_employee_cardswipe,i_employee_ordinal,i_employees_current_timesheet_id,i_employee_ticketlist_schema,dt_employee_liquor_card_exp_date,dt_employee_health_card_exp_date,s_employee_payroll_id,s_password_hash,s_password_salt,dt_password_changed,i_authentication_failures,dt_lockout,i_security_template_id,rv_Employees,g_Employees_id,i_external_id) VALUES (151,'Annie Heffernan',3396,1,0,0,0,NULL,NULL,0,NULL,NULL,NULL,NULL,'1753-01-01 00:00:00.000','1753-01-01 00:00:00.000','1753-01-01 00:00:00.000','1753-01-01 00:00:00.000',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,4,15721,9402,'1753-01-01 00:00:00.000','1753-01-01 00:00:00.000',NULL,NULL,NULL,NULL,NULL,NULL,3,0x000000000105E655,'2C2D9338-6F7A-4C67-8E67-D88C2DFCDE3D',NULL);
    INSERT INTO mytable(i_employee_id,s_name,s_login,b_active,b_admin,b_is_clocked_in,b_is_logged_in,dt_clock_in,dt_expected_clock_out,i_employ_id,s_phone1,s_phone2,s_emerg_phone,s_SSN,dt_hire,dt_term,dt_review,dt_birth,s_first,s_middle,s_last,s_street,s_street2,s_city,s_state,s_postal,s_email,s_employee_cardswipe,i_employee_ordinal,i_employees_current_timesheet_id,i_employee_ticketlist_schema,dt_employee_liquor_card_exp_date,dt_employee_health_card_exp_date,s_employee_payroll_id,s_password_hash,s_password_salt,dt_password_changed,i_authentication_failures,dt_lockout,i_security_template_id,rv_Employees,g_Employees_id,i_external_id) VALUES (154,'Mat Moreira',7298,1,0,0,0,NULL,NULL,0,NULL,NULL,NULL,NULL,'1753-01-01 00:00:00.000','1753-01-01 00:00:00.000','1753-01-01 00:00:00.000','1753-01-01 00:00:00.000',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16,16009,15712,'1753-01-01 00:00:00.000','1753-01-01 00:00:00.000',NULL,NULL,NULL,NULL,NULL,NULL,3,0x000000000105E661,'4BD64193-EB71-4617-A001-029F95B40D8D',NULL);
    INSERT INTO mytable(i_employee_id,s_name,s_login,b_active,b_admin,b_is_clocked_in,b_is_logged_in,dt_clock_in,dt_expected_clock_out,i_employ_id,s_phone1,s_phone2,s_emerg_phone,s_SSN,dt_hire,dt_term,dt_review,dt_birth,s_first,s_middle,s_last,s_street,s_street2,s_city,s_state,s_postal,s_email,s_employee_cardswipe,i_employee_ordinal,i_employees_current_timesheet_id,i_employee_ticketlist_schema,dt_employee_liquor_card_exp_date,dt_employee_health_card_exp_date,s_employee_payroll_id,s_password_hash,s_password_salt,dt_password_changed,i_authentication_failures,dt_lockout,i_security_template_id,rv_Employees,g_Employees_id,i_external_id) VALUES (155,'Whitney Testorf',1203,1,0,0,0,NULL,NULL,0,NULL,NULL,NULL,NULL,'1753-01-01 00:00:00.000','1753-01-01 00:00:00.000','1753-01-01 00:00:00.000','1753-01-01 00:00:00.000',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,19,15984,6251,'1753-01-01 00:00:00.000','1753-01-01 00:00:00.000',NULL,NULL,NULL,NULL,NULL,NULL,3,0x000000000105E664,'755E218B-DFCD-456A-A9F0-D138B1FF9FE9',NULL);
    INSERT INTO mytable(i_employee_id,s_name,s_login,b_active,b_admin,b_is_clocked_in,b_is_logged_in,dt_clock_in,dt_expected_clock_out,i_employ_id,s_phone1,s_phone2,s_emerg_phone,s_SSN,dt_hire,dt_term,dt_review,dt_birth,s_first,s_middle,s_last,s_street,s_street2,s_city,s_state,s_postal,s_email,s_employee_cardswipe,i_employee_ordinal,i_employees_current_timesheet_id,i_employee_ticketlist_schema,dt_employee_liquor_card_exp_date,dt_employee_health_card_exp_date,s_employee_payroll_id,s_password_hash,s_password_salt,dt_password_changed,i_authentication_failures,dt_lockout,i_security_template_id,rv_Employees,g_Employees_id,i_external_id) VALUES (168,'Brianna Wilcox',9739,1,0,1,0,'2017-06-11 07:58:37.960',NULL,0,NULL,NULL,NULL,NULL,'1753-01-01 00:00:00.000','1753-01-01 00:00:00.000','1753-01-01 00:00:00.000','1753-01-01 00:00:00.000',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,5,16049,2447,'1753-01-01 00:00:00.000','1753-01-01 00:00:00.000',NULL,NULL,NULL,NULL,NULL,NULL,3,0x000000000105E656,'B70F711A-8FC0-4561-BD0A-A7A229117DA9',NULL);

    CREATE TABLE Employees(
     i_employee_id       INTEGER NOT NULL PRIMARY KEY
    ,s_name         VARCHAR2(17) NOT NULL
    ,s_login         INTEGER NOT NULL
    ,b_active         BIT NOT NULL
    ,b_admin         BIT NOT NULL
    ,b_is_clocked_in      BIT NOT NULL
    ,b_is_logged_in       BIT NOT NULL
    ,dt_clock_in        VARCHAR2(23)
    ,dt_expected_clock_out    VARCHAR(4)
    ,i_employ_id        BIT NOT NULL
    ,s_phone1         VARCHAR(30)
    ,s_phone2         VARCHAR(30)
    ,s_emerg_phone       VARCHAR(30)
    ,s_SSN          VARCHAR(30)
    ,dt_hire         VARCHAR(23) NOT NULL
    ,dt_term         VARCHAR(23) NOT NULL
    ,dt_review        VARCHAR(23) NOT NULL
    ,dt_birth         VARCHAR(23) NOT NULL
    ,s_first         VARCHAR(30)
    ,s_middle         VARCHAR(30)
    ,s_last         VARCHAR(30)
    ,s_street         VARCHAR(30)
    ,s_street2        VARCHAR(30)
    ,s_city         VARCHAR(30)
    ,s_state         VARCHAR(30)
    ,s_postal         VARCHAR(30)
    ,s_email         VARCHAR(30)
    ,s_employee_cardswipe     VARCHAR(30)
    ,i_employee_ordinal     INTEGER NOT NULL
    ,i_employees_current_timesheet_id INTEGER NOT NULL
    ,i_employee_ticketlist_schema  INTEGER NOT NULL
    ,dt_employee_liquor_card_exp_date VARCHAR(23) NOT NULL
    ,dt_employee_health_card_exp_date VARCHAR(23) NOT NULL
    ,s_employee_payroll_id    VARCHAR(30)
    ,s_password_hash      VARCHAR(4)
    ,s_password_salt      VARCHAR(4)
    ,dt_password_changed     VARCHAR(4)
    ,i_authentication_failures   VARCHAR(4)
    ,dt_lockout        VARCHAR(4)
    ,i_security_template_id    INTEGER NOT NULL
    ,rv_Employees       INTEGER NOT NULL
    ,g_Employees_id       VARCHAR(36) NOT NULL
    ,i_external_id       VARCHAR(4)
    );
    INSERT INTO mytable(i_employee_id,s_name,s_login,b_active,b_admin,b_is_clocked_in,b_is_logged_in,dt_clock_in,dt_expected_clock_out,i_employ_id,s_phone1,s_phone2,s_emerg_phone,s_SSN,dt_hire,dt_term,dt_review,dt_birth,s_first,s_middle,s_last,s_street,s_street2,s_city,s_state,s_postal,s_email,s_employee_cardswipe,i_employee_ordinal,i_employees_current_timesheet_id,i_employee_ticketlist_schema,dt_employee_liquor_card_exp_date,dt_employee_health_card_exp_date,s_employee_payroll_id,s_password_hash,s_password_salt,dt_password_changed,i_authentication_failures,dt_lockout,i_security_template_id,rv_Employees,g_Employees_id,i_external_id) VALUES (132,'Hannah Snow',1992,1,0,1,0,'2016-11-16 13:30:30.727',NULL,0,NULL,NULL,NULL,NULL,'1753-01-01 00:00:00.000','1753-01-01 00:00:00.000','1753-01-01 00:00:00.000','1753-01-01 00:00:00.000',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8,16035,3358,'1753-01-01 00:00:00.000','1753-01-01 00:00:00.000',NULL,NULL,NULL,NULL,NULL,NULL,3,0x000000000105E659,'7EB4D5C4-2069-4698-AFF7-D9A88C0B6292',NULL);
    INSERT INTO mytable(i_employee_id,s_name,s_login,b_active,b_admin,b_is_clocked_in,b_is_logged_in,dt_clock_in,dt_expected_clock_out,i_employ_id,s_phone1,s_phone2,s_emerg_phone,s_SSN,dt_hire,dt_term,dt_review,dt_birth,s_first,s_middle,s_last,s_street,s_street2,s_city,s_state,s_postal,s_email,s_employee_cardswipe,i_employee_ordinal,i_employees_current_timesheet_id,i_employee_ticketlist_schema,dt_employee_liquor_card_exp_date,dt_employee_health_card_exp_date,s_employee_payroll_id,s_password_hash,s_password_salt,dt_password_changed,i_authentication_failures,dt_lockout,i_security_template_id,rv_Employees,g_Employees_id,i_external_id) VALUES (133,'Mackenzie Reed',1998,1,0,0,0,NULL,NULL,0,NULL,NULL,NULL,NULL,'1753-01-01 00:00:00.000','1753-01-01 00:00:00.000','1753-01-01 00:00:00.000','1753-01-01 00:00:00.000',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13,16006,16966,'1753-01-01 00:00:00.000','1753-01-01 00:00:00.000',NULL,NULL,NULL,NULL,NULL,NULL,4,0x000000000105E65E,'97434887-3118-4609-8D19-1645192BE838',NULL);
    INSERT INTO mytable(i_employee_id,s_name,s_login,b_active,b_admin,b_is_clocked_in,b_is_logged_in,dt_clock_in,dt_expected_clock_out,i_employ_id,s_phone1,s_phone2,s_emerg_phone,s_SSN,dt_hire,dt_term,dt_review,dt_birth,s_first,s_middle,s_last,s_street,s_street2,s_city,s_state,s_postal,s_email,s_employee_cardswipe,i_employee_ordinal,i_employees_current_timesheet_id,i_employee_ticketlist_schema,dt_employee_liquor_card_exp_date,dt_employee_health_card_exp_date,s_employee_payroll_id,s_password_hash,s_password_salt,dt_password_changed,i_authentication_failures,dt_lockout,i_security_template_id,rv_Employees,g_Employees_id,i_external_id) VALUES (147,'Erica Archambault',0702,1,0,1,0,'2017-04-18 16:18:14.447',NULL,0,NULL,NULL,NULL,NULL,'1753-01-01 00:00:00.000','1753-01-01 00:00:00.000','1753-01-01 00:00:00.000','1753-01-01 00:00:00.000',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7,16043,24354,'1753-01-01 00:00:00.000','1753-01-01 00:00:00.000',NULL,NULL,NULL,NULL,NULL,NULL,3,0x000000000105E658,'10207DA7-A24E-4D33-AC17-74C3FD8E2B6F',NULL);
    INSERT INTO mytable(i_employee_id,s_name,s_login,b_active,b_admin,b_is_clocked_in,b_is_logged_in,dt_clock_in,dt_expected_clock_out,i_employ_id,s_phone1,s_phone2,s_emerg_phone,s_SSN,dt_hire,dt_term,dt_review,dt_birth,s_first,s_middle,s_last,s_street,s_street2,s_city,s_state,s_postal,s_email,s_employee_cardswipe,i_employee_ordinal,i_employees_current_timesheet_id,i_employee_ticketlist_schema,dt_employee_liquor_card_exp_date,dt_employee_health_card_exp_date,s_employee_payroll_id,s_password_hash,s_password_salt,dt_password_changed,i_authentication_failures,dt_lockout,i_security_template_id,rv_Employees,g_Employees_id,i_external_id) VALUES (151,'Annie Heffernan',3396,1,0,0,0,NULL,NULL,0,NULL,NULL,NULL,NULL,'1753-01-01 00:00:00.000','1753-01-01 00:00:00.000','1753-01-01 00:00:00.000','1753-01-01 00:00:00.000',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,4,15721,9402,'1753-01-01 00:00:00.000','1753-01-01 00:00:00.000',NULL,NULL,NULL,NULL,NULL,NULL,3,0x000000000105E655,'2C2D9338-6F7A-4C67-8E67-D88C2DFCDE3D',NULL);
    INSERT INTO mytable(i_employee_id,s_name,s_login,b_active,b_admin,b_is_clocked_in,b_is_logged_in,dt_clock_in,dt_expected_clock_out,i_employ_id,s_phone1,s_phone2,s_emerg_phone,s_SSN,dt_hire,dt_term,dt_review,dt_birth,s_first,s_middle,s_last,s_street,s_street2,s_city,s_state,s_postal,s_email,s_employee_cardswipe,i_employee_ordinal,i_employees_current_timesheet_id,i_employee_ticketlist_schema,dt_employee_liquor_card_exp_date,dt_employee_health_card_exp_date,s_employee_payroll_id,s_password_hash,s_password_salt,dt_password_changed,i_authentication_failures,dt_lockout,i_security_template_id,rv_Employees,g_Employees_id,i_external_id) VALUES (154,'Mat Moreira',7298,1,0,0,0,NULL,NULL,0,NULL,NULL,NULL,NULL,'1753-01-01 00:00:00.000','1753-01-01 00:00:00.000','1753-01-01 00:00:00.000','1753-01-01 00:00:00.000',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16,16009,15712,'1753-01-01 00:00:00.000','1753-01-01 00:00:00.000',NULL,NULL,NULL,NULL,NULL,NULL,3,0x000000000105E661,'4BD64193-EB71-4617-A001-029F95B40D8D',NULL);
    INSERT INTO mytable(i_employee_id,s_name,s_login,b_active,b_admin,b_is_clocked_in,b_is_logged_in,dt_clock_in,dt_expected_clock_out,i_employ_id,s_phone1,s_phone2,s_emerg_phone,s_SSN,dt_hire,dt_term,dt_review,dt_birth,s_first,s_middle,s_last,s_street,s_street2,s_city,s_state,s_postal,s_email,s_employee_cardswipe,i_employee_ordinal,i_employees_current_timesheet_id,i_employee_ticketlist_schema,dt_employee_liquor_card_exp_date,dt_employee_health_card_exp_date,s_employee_payroll_id,s_password_hash,s_password_salt,dt_password_changed,i_authentication_failures,dt_lockout,i_security_template_id,rv_Employees,g_Employees_id,i_external_id) VALUES (155,'Whitney Testorf',1203,1,0,0,0,NULL,NULL,0,NULL,NULL,NULL,NULL,'1753-01-01 00:00:00.000','1753-01-01 00:00:00.000','1753-01-01 00:00:00.000','1753-01-01 00:00:00.000',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,19,15984,6251,'1753-01-01 00:00:00.000','1753-01-01 00:00:00.000',NULL,NULL,NULL,NULL,NULL,NULL,3,0x000000000105E664,'755E218B-DFCD-456A-A9F0-D138B1FF9FE9',NULL);
    INSERT INTO mytable(i_employee_id,s_name,s_login,b_active,b_admin,b_is_clocked_in,b_is_logged_in,dt_clock_in,dt_expected_clock_out,i_employ_id,s_phone1,s_phone2,s_emerg_phone,s_SSN,dt_hire,dt_term,dt_review,dt_birth,s_first,s_middle,s_last,s_street,s_street2,s_city,s_state,s_postal,s_email,s_employee_cardswipe,i_employee_ordinal,i_employees_current_timesheet_id,i_employee_ticketlist_schema,dt_employee_liquor_card_exp_date,dt_employee_health_card_exp_date,s_employee_payroll_id,s_password_hash,s_password_salt,dt_password_changed,i_authentication_failures,dt_lockout,i_security_template_id,rv_Employees,g_Employees_id,i_external_id) VALUES (168,'Brianna Wilcox',9739,1,0,1,0,'2017-06-11 07:58:37.960',NULL,0,NULL,NULL,NULL,NULL,'1753-01-01 00:00:00.000','1753-01-01 00:00:00.000','1753-01-01 00:00:00.000','1753-01-01 00:00:00.000',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,5,16049,2447,'1753-01-01 00:00:00.000','1753-01-01 00:00:00.000',NULL,NULL,NULL,NULL,NULL,NULL,3,0x000000000105E656,'B70F711A-8FC0-4561-BD0A-A7A229117DA9',NULL);

    this script fails.

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • Thanks for putting in the effort to give us consumable DDL and sample data!

    As J pointed out, the scripts don't work in their current form, for a few reasons.

    The INSERTs are all inserting into an object called 'mytable', when they need to be inserting into the created tables.

    Also, the datatypes for some of the columns have issues.

    There's a VARCHAR2 column, which is a data type in Oracle but not SQL Server.

    One column tries to be defined as a VARCHAR(10018); that should be VARCHAR(MAX).

    The ticket id columns got inferred as DATE for some reason, which causes the INSERTs to fail.

    For table definitions, it's much better to just right click and script them out so data types are correct. The other tool simplifies generating the INSERT statements, but it can't really be trusted to infer all data types correctly.

    As nice as it is to do everything in one place, I highly recommend using SSMS to script out your tables, and then you can use that tool to generate the INSERTs. If you do use that tool to do everything, then you have to go through and check all the datatypes to make sure they're correct.

    Having said all that, I think I understand what you're asking, and if I do, that's honestly not something that should be handled at the  SQL Server layer.

    As I understand it, your point is that for Rows with a Row#>1, you don't want values in any of the columns except for Choice Added?

    If so, that really should be handled at the presentation layer.

    For the other requirement,  the straightforward way would be to do a LEFT JOIN to the ChoiceItem table instead of doing an INNER JOIN.

    Cheers!

  • I know why its failing, I will repost

Viewing 15 posts - 16 through 30 (of 32 total)

You must be logged in to reply to this topic. Login to reply