Page 1 of 1

SQL

Posted: Wed May 29, 2024 10:08 pm
by admin
Sample Query in Ledger


Hint : Use in Calculator Panel on by one


For More on Tally SQL Refer https://github.com/ramajayam-CA/Tally-S ... [url][url][/url][/url]



Code: Select all

Selecting all Ledger names
  
  Select * from Ledger 



Select $Name from Ledger

Ledger name with GSTIN

Select $Name, $PARTYGSTIN from ledger

Select $Name, $PARTYGSTIN from ledger where $Parent Like "%Sundry Debtors%"


Select $Name, $Parent, $PARTYGSTIN from ledger where $Parent Like "%Sundry Debtors%"

Select $Name, $Parent, $PARTYGSTIN from ledger where $Parent Like "%Sundry creditors"

Select $Name, $Parent, $PARTYGSTIN from ledger where $Parent Like "%Sundry creditors%" or $Parent Like "%Sundry Debtors%" 

Select $Name, $Parent, $PARTYGSTIN from ledger where $Parent Like "%Sundry creditors%" or $Parent Like "%Sundry Debtors%"  and $PartyGSTIN is not null

Select $Name, $Parent, $PARTYGSTIN from ledger where $Parent Like "%Sundry creditors%" or $Parent Like "%Sundry Debtors%"  and $PartyGSTIN is null

Select $Name, $Parent, $_PrimaryGroup, $ClosingBalance from ledger

SELECT $Name, $ClosingBalance FROM Ledger WHERE $$IsDr:$ClosingBalance

Select $Name, $Parent, $_PrimaryGroup, $$AscrAmt:$ClosingBalance from ledger

Select $Name, $Parent, $_PrimaryGroup, $$AscrAmt:$ClosingBalance as Closing_Balance from ledger

***String Start with the word Sundry Creditors
Select $Name, $Parent, $PARTYGSTIN from ledger where $Parent Like "%Sundry creditors"

***String is contains the word Sundry Creditors
Select $Name, $Parent, $PARTYGSTIN from ledger where $Parent Like "%Sundry creditors%"

***String end with the word Sundry Creditors
Select $Name, $Parent, $PARTYGSTIN from ledger where $Parent Like "Sundry creditors%"

***String is contains the word S any where in the parent string
Select $Name, $Parent, $PARTYGSTIN from ledger where $Parent Like "%S%"


Select $Name, $Parent, $_PrimaryGroup, $OpeningBalance, $ClosingBalance, $Isrevenue from ledger 


Re: SQL Date Filter

Posted: Tue Mar 18, 2025 3:48 am
by ramajayam

Code: Select all

Select $Name, $Createdby, $CreatedDate, $Masterid, $Alterid, $Alteredon, $Alteredby, $Updateddatetime, $LastVoucherDate, $Parent, $_PrimaryGroup, $$AscrAmt:$openingBalance, $$AscrAmt:$_ClosingBalance from ledger where $CreatedDate >= $$Date:"01-04-2024" 

Re: SQL Credit Balance only

Posted: Tue Mar 18, 2025 4:02 am
by admin

Code: Select all

SELECT $Name, $_PrimaryGroup, $$Ascramt:$ClosingBalance FROM Ledger WHERE not $$IsDr:$ClosingBalance

Re: SQL Debit Balance only

Posted: Tue Mar 18, 2025 4:02 am
by admin

Code: Select all

SELECT $Name, $_PrimaryGroup, $$Ascramt:$ClosingBalance FROM Ledger WHERE $$IsDr:$ClosingBalance