Click here to Skip to main content
15,892,746 members
Home / Discussions / Database
   

Database

 
GeneralRe: How to get data from OracleDatabase to SQL Server automaticly Pin
hmanhha3-Mar-16 16:02
hmanhha3-Mar-16 16:02 
QuestionOrder by by using levels using sql Script Pin
indian14322-Feb-16 10:55
indian14322-Feb-16 10:55 
AnswerRe: Order by by using levels using sql Script Pin
Mathi Mani22-Feb-16 14:37
Mathi Mani22-Feb-16 14:37 
GeneralRe: Order by by using levels using sql Script Pin
CHill6025-Feb-16 5:07
mveCHill6025-Feb-16 5:07 
AnswerRe: Order by by using levels using sql Script Pin
CHill6025-Feb-16 5:05
mveCHill6025-Feb-16 5:05 
QuestionRecursive Common Table Expressions Pin
Amr.Mohammad8720-Feb-16 9:10
Amr.Mohammad8720-Feb-16 9:10 
SuggestionRe: Recursive Common Table Expressions Pin
CHill6020-Feb-16 9:43
mveCHill6020-Feb-16 9:43 
GeneralRe: Recursive Common Table Expressions Pin
Amr.Mohammad8720-Feb-16 11:21
Amr.Mohammad8720-Feb-16 11:21 
SQL
WITH TradingReceivableAccounts (AccountID, AccountCode, AccountName, GeneralAccount, AccountBranch, NatureOfAccount, AccountType, DebtorValue, CreditorValue, [Entry], [Description]) AS
(SELECT at.Account_ID, 
		at.Account_Code, 
		at.Account_Name1, 
		at.Account_Isleaf, 
		aib.AccountBranch_BranchID, 
		aib.AccountBranch_Natural, 
		aib.AccountBranch_Type, 
		ISNULL(aib.AccountBranch_LocalDebit, 0) AS DebtorValue, 
		ISNULL(aib.AccountBranch_LocalCredit, 0) AS CreditorValue,
		CAST(NULL AS NVARCHAR(250)) AS [Entry],
		N'TradingReceivableAccounts' AS [Description]
FROM AccountTree AS at INNER JOIN Account_InBranch AS aib 
								ON  at.Account_ID = aib.AccountBranch_AccountID 
								AND aib.AccountBranch_Natural = 1
								AND aib.AccountBranch_Type = 2
								AND aib.AccountBranch_BranchID = 1
								        
UNION ALL
SELECT ac.Account_ID,
	   ac.Account_Code, 
	   ac.Account_Name1, 
	   ac.Account_Isleaf, 
	   CAST(0 AS INT) AS AccountBranch, 
	   CAST(0 AS BIT) AS NatureOfAccount, 
	   CAST(0 AS TINYINT) AS AccountType,  
	   jd.JournalDet_Debit,
	   jd.JournalDet_Credit,
	   CAST(jh.Journal_Code AS NVARCHAR(250)),
	   N'TradingReceivableAccounts' AS [Description]
FROM  TradingReceivableAccounts AS CTE INNER JOIN AccountTree AS ac
		ON CTE.AccountID = ac.Account_ID
		INNER JOIN Journal_Details AS jd
	    ON jd.JournalDet_AccountID = ac.Account_ID
	    INNER JOIN Journal_Head AS jh
	    ON  jh.Journal_ID = jd.JournalDet_HeadID
	    AND jh.Journal_BranchID = CTE.AccountBranch
		AND jh.Journal_Date < N'02/18/2016')


The above query have the same idea. The anchor member returns a specific types of financial accounts and the recursive member gets all the payments\receipts transactions associated with each account. For example, lets say the anchor query returns the accounts 1, 2, 3, and 4 and with each account returned the recursive member will return all the payments\receipts associated with the account. I need to know how it will work behind the scene.
GeneralRe: Recursive Common Table Expressions Pin
CHill6020-Feb-16 23:57
mveCHill6020-Feb-16 23:57 
GeneralRe: Recursive Common Table Expressions Pin
Amr.Mohammad8721-Feb-16 7:04
Amr.Mohammad8721-Feb-16 7:04 
GeneralRe: Recursive Common Table Expressions Pin
Jörgen Andersson21-Feb-16 7:31
professionalJörgen Andersson21-Feb-16 7:31 
GeneralRe: Recursive Common Table Expressions Pin
CHill6021-Feb-16 8:04
mveCHill6021-Feb-16 8:04 
GeneralRe: Recursive Common Table Expressions Pin
Jörgen Andersson21-Feb-16 21:34
professionalJörgen Andersson21-Feb-16 21:34 
GeneralRe: Recursive Common Table Expressions Pin
CHill6021-Feb-16 22:19
mveCHill6021-Feb-16 22:19 
GeneralRe: Recursive Common Table Expressions Pin
Jörgen Andersson21-Feb-16 22:30
professionalJörgen Andersson21-Feb-16 22:30 
GeneralRe: Recursive Common Table Expressions Pin
Amr.Mohammad8722-Feb-16 10:28
Amr.Mohammad8722-Feb-16 10:28 
QuestionEntity Pin
mohsen47319-Feb-16 21:03
mohsen47319-Feb-16 21:03 
QuestionSQLPrepare error: [Microsoft][ODBC Microsoft Access Driver] Invalid SQL statement; expected 'DELETE', 'INSERT', 'PROCEDURE', 'SELECT', or 'UPDATE'. Pin
Member 1233569519-Feb-16 17:48
Member 1233569519-Feb-16 17:48 
Questionhow to set/retrieve data directory and index directory of a table of mysql database Pin
CanadaProgrammer16-Feb-16 23:37
CanadaProgrammer16-Feb-16 23:37 
AnswerRe: how to set/retrieve data directory and index directory of a table of mysql database Pin
Richard MacCutchan16-Feb-16 23:54
mveRichard MacCutchan16-Feb-16 23:54 
QuestionHow to setup a local database for my application Pin
Theo Buys16-Feb-16 22:55
Theo Buys16-Feb-16 22:55 
AnswerRe: How to setup a local database for my application Pin
Richard MacCutchan16-Feb-16 23:52
mveRichard MacCutchan16-Feb-16 23:52 
GeneralRe: How to setup a local database for my application Pin
Theo Buys17-Feb-16 5:31
Theo Buys17-Feb-16 5:31 
GeneralRe: How to setup a local database for my application Pin
Richard MacCutchan17-Feb-16 5:42
mveRichard MacCutchan17-Feb-16 5:42 
GeneralRe: How to setup a local database for my application Pin
Theo Buys17-Feb-16 7:24
Theo Buys17-Feb-16 7:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.