January 29, 2013 at 10:49 am
Dear All,
I have tables in my database and need to extract some output.
Any help is welcome as shown in the attachment.
Regards.
January 29, 2013 at 11:06 am
mbamutura (1/29/2013)
Dear All,I have tables in my database and need to extract some output.
Any help is welcome as shown in the attachment.
Regards.
Course work? Show some effort and ask specific questions, and you will get help.
January 29, 2013 at 11:44 am
DiverKas (1/29/2013)
mbamutura (1/29/2013)
Dear All,I have tables in my database and need to extract some output.
Any help is welcome as shown in the attachment.
Regards.
Course work? Show some effort and ask specific questions, and you will get help.
Hi DiverKas,
I just created sample tables to show the area I need help, but below is my code which is giving Duplicates ;
use MSDB;
select
[dbo].[tbl_VOUCHER_ISSUE].dt_VOUCHER_ISSUE_DATE,
[dbo].[tbl_VOUCHER_ISSUE_DETAIL].str_BARCODE,
[dbo].[tbl_VOUCHER_ISSUE_DETAIL].int_STATUS,
[dbo].[tbl_SALES_EXECUTIVE_MASTER].str_SALES_EXECUTIVE_NAME
FROM
[dbo].[tbl_VOUCHER_ISSUE]
Left Join [dbo].[tbl_VOUCHER_ISSUE_DETAIL]
ON [dbo].[tbl_VOUCHER_ISSUE].int_VOUCHER_ISSUE_ID = [dbo].[tbl_VOUCHER_ISSUE_DETAIL].int_VOUCHER_ISSUE_ID
Left Join [dbo].[tbl_SALES_EXECUTIVE_MASTER]
ON [dbo].[tbl_VOUCHER_ISSUE].int_SALES_TEAM_ID = [dbo].[tbl_VOUCHER_ISSUE].int_SALES_TEAM_ID
WHERE
[dbo].[tbl_VOUCHER_ISSUE_DETAIL].str_BARCODE LIKE 'FPUG%' AND
[dbo].[tbl_VOUCHER_ISSUE].dt_VOUCHER_ISSUE_DATE between '2012-12-01' and '2012-12-31' AND
[dbo].[tbl_VOUCHER_ISSUE_DETAIL].int_STATUS !=5
ORDER BY
[dbo].[tbl_SALES_EXECUTIVE_MASTER].str_SALES_EXECUTIVE_NAME
January 29, 2013 at 12:28 pm
It seems you are new around here. Welcome!!! In order to provide help we need to have enough details. That means we need ddl, sample data and desired output based on that sample data. This should be a readily consumable format (meaning we can hit F5 in SSMS). Please see the first link in my signature for best practices when posting questions.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply