SQL query problem, listing all deliveries linked to an invoice
Hi I'm trying to write a query that returns all the deliveries linked to an invoice as a single commaseparated result.
This query gets all the links from every line as a commaseparated result but I want to remove the duplicate entries, eg. where/how do I insert the distinct clause?
DECLARE @EmployeeList varchar(350)
SELECT @EmployeeList = COALESCE(@EmployeeList + ', ', '') +
( T1.baseref )
FROM oinv T0 inner join inv1 T1 on T0.DocEntry = T1.DocEntry
where T0.docnum = 119229 and T1.baseref <> ''
SELECT @EmployeeList
Thanks in advance for all help
Hi,
How did you use the temporary table?
Can you write your code here.
I am also getting repeated data values in my query output. I want to save that query output into one temporary table and than want to use the SELECT DISTINCT on that temporary table. I am searching on forum madely to do that but can't find the perfect help. It will be nice if you can help me in that.
Thank you
Similar Messages
-
PLEASE SEND ME SQL query to list ALL CONSTRAINTS ON EMPLOYEES TABLE FROM OU
PLEASE SEND ME SQL query to list ALL CONSTRAINTS ON EMPLOYEES TABLE FROM OUTSIDE PP SCHEMA INCLUDING SCHEMA NAME AND CONSTraint NAME
Username : PP
Table : EmployeesI think you are looking for below query :
SQL> SHOW USER;
USER is "SCOTT"
SQL> select owner,constraint_name,constraint_type,table_name,r_owner,r_constraint_name
2 from all_constraints
3 where constraint_type='R'
4 and r_constraint_name in (select constraint_name from all_constraints
5 where constraint_type in ('P','U') and table_name='EMP');
OWNER CONSTRAINT_NAME C TABLE_NAME R_OWNER R_CONSTRAINT_NAME
TEST1 ERL_EMP_FK_1 R EMPLOYEE SCOTT PK_EMP
1 row selected.Means, TEST1 user is having a constraint ERL_EMP_FK_1 on his table EMPLOYEE. Which is using PK_EMP (primary key of SCOTT user's 'EMP' [in the query])
Regards
Girish Sharma -
Hi guys, I have the below query which lists all the collections and their members, however I need to expand it to also include the OS, Service Pack, IP and if it's a physical or virtual machine.
I've tried a few things but only made it worse. Is anyone able to expand the below code to include those extras??
SELECT
v_FullCollectionMembership.CollectionID AS 'CollID',
v_Collection.Name AS 'CollName',
v_FullCollectionMembership.Name AS 'SystemName'
FROM
v_FullCollectionMembership, v_Collection
WHERE v_FullCollectionMembership.CollectionID = v_Collection.CollectionID
ORDER BY
CollID ASC, SystemName ASCHi,
These requirements could be found in several threads or blogs. We need convert WQL to SQL, and you can involve SQL guys to integrate the statements and format the result.
How to create a all virtual machines collection.
SCCM SQL Query - IP Address
ConfigMgr Systems without Current Service Packs, and System Patch Status -
Sql query to list menus, submenus and function-names for all resp
Hi,
Please let me know one single sql query to list all the menus, submenus and user-function-names attached for all responsibilities
Thanks...Hi,
See the following threads.
How to find All The Responsibilities with a specific Menu
How to find All The Responsibilities with a specific Menu
SQL query
SQL query
Regards,
Hussein -
SQL query to list the "Administrative category" field for all applications
yesterday i started a thread to list the "Optional reference" field for all cm applications in a SSRS report. I've got the query with the help of Torsten.
https://social.technet.microsoft.com/Forums/en-US/00419e6e-e3c2-4b80-b6af-2a24ced1032d/sql-query-to-list-the-optional-reference-field-of-all-packages-in-cm-2012?forum=configmanagersdk
But again today, i'm looking for a way to get "Administrative category" field in a SSRS report. Could someone point me to the right direction ?
Kindly mark as answer/Vote as helpful if a reply from anybody helped you in this forum. DelphinHi,
You could monitor the SMSProv.log when you check the category of an application. It shows that SQL query the SCCM provider used is related to function fn_ListCategoryInstances.
Best Regards,
Joyce -
Need a query to list all table names
I have more than 500 tables in my database.
'insert_date' & 'update_date' columns are found in more than 100 tables with data type as date.
I need a query to list all table names and 'insert_date' , 'update_date' column's content.
Please Help
Lee1212
Message was edited by:
LEE1212I have more than 500 tables in my database.
'insert_date' & update_date column is found in more
than 100 tables with data type as date.
I need a query to list all table names and
'insert_date' column's content.What do you mean by "column's content". A table can have many rows. Do you want to display all the distinct value for these columns?
Below is the query to get the tables which has columns insert_Date and update_date
select table_name
from user_tab_columns
where column_name ='INSERT_DATE'
or column_name ='UPDATE_DATE'
/You can write a PL/SQL block to retrive the distinct values of INSERT_DATE for these tables
declare
TYPE ref_cur IS REF CURSOR;
insert_date_cur ref_cur;
lv_insert_date DATE;
cursor tables_list IS
select table_name
from user_tab_columns
where column_name ='INSERT_DATE';
begin
for cur_tables in tables_list
loop
OPEN insert_date_cur for 'SELECT DISTINCT insert_date from '||cur_tables.table_name;
DBMS_OUTPUT.PUT_LINE(cur_tables.table_name);
DBMS_OUTPUT.PUT_LINE('--------------------------------');
LOOP
FETCH insert_date_cur into lv_insert_date;
EXIT WHEN insert_date_cur%NOTFOUND;
DBMS_OUTPUT.PUT_LINE(lv_insert_date);
END LOOP;
CLOSE insert_date_cur;
end loop;
end;I haven't tested this code. There might be some errors. Just posted something to start with for you. -
Sql query to identify all the responsibilities attached to a form
(oracle - apps) Can anyone help me by giving a sql query to identify all the responsibilities attached to a form and corresponding menu should not be in the menu exclusion.
Thanks in advance
VenkiBump
-
Reg: sql query that prints all sundays in the year
Hi all,
Please give me sql query that prints all sundays in year. And when ever we execute that query then that will prints the sysdate(that is execution date).
Thanks in Advance,
-prasad.
Edited by: prasad_orcl on Jun 5, 2009 9:13 PMHi,
Plz try this and let me know this works or not...
SELECT DATE DATES,TO_CHAR(DATE,'DAY') DAYS FROM FISCAL_CALENDAR
WHERE DATE_YEAR = 2009 AND
DATE BETWEEN TRUNC(SYSDATE,'YEAR') AND
ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),12) -1 AND
TRIM(TO_CHAR(DATE,'DAY')) = 'SUNDAY'
ORDER BY DATE
OUTPUT:
DATES DAYS
1/4/2009 SUNDAY
1/11/2009 SUNDAY
1/18/2009 SUNDAY
1/25/2009 SUNDAY
2/1/2009 SUNDAY
2/8/2009 SUNDAY
2/15/2009 SUNDAY
2/22/2009 SUNDAY
3/1/2009 SUNDAY
3/8/2009 SUNDAY
3/15/2009 SUNDAY
3/22/2009 SUNDAY
3/29/2009 SUNDAY
4/5/2009 SUNDAY
4/12/2009 SUNDAY
4/19/2009 SUNDAY
4/26/2009 SUNDAY
5/3/2009 SUNDAY
5/10/2009 SUNDAY
5/17/2009 SUNDAY
5/24/2009 SUNDAY
5/31/2009 SUNDAY
6/7/2009 SUNDAY
6/14/2009 SUNDAY
6/21/2009 SUNDAY
6/28/2009 SUNDAY
7/5/2009 SUNDAY
7/12/2009 SUNDAY
7/19/2009 SUNDAY
7/26/2009 SUNDAY
8/2/2009 SUNDAY
8/9/2009 SUNDAY
8/16/2009 SUNDAY
8/23/2009 SUNDAY
8/30/2009 SUNDAY
9/6/2009 SUNDAY
9/13/2009 SUNDAY
9/20/2009 SUNDAY
9/27/2009 SUNDAY
10/4/2009 SUNDAY
10/11/2009SUNDAY
10/18/2009SUNDAY
10/25/2009SUNDAY
11/1/2009 SUNDAY
11/8/2009 SUNDAY
11/15/2009SUNDAY
11/22/2009SUNDAY
11/29/2009SUNDAY
12/6/2009 SUNDAY
12/13/2009SUNDAY
12/20/2009SUNDAY
12/27/2009SUNDAY
Regards
Thiyag -
SQL query which return all the NET SERVICES which are avaiable in tnsname
hi all
how to write a sql query which return all the net services which are avaiable in tnsname.ora
Regards
sAlso, tnsnames.ora is stored on the client, and not necessarily on the server; it's possible (and quite likely) that the name I use for a database in my tnsnames.ora could be different from the name you use for the same database; conversely we might use the same name for two different databases.
Regards Nigel -
Sql query to find all contacts for an account
I wonder if someone wrote an sql query to find all contacts for an account number in Oracle customer master. We are on EBS 11.5.10.
I am also looking for sql query to find all ship to addresses for an account number.
Thanks.Can you also post the query for people who read this post and are also looking for an answer?
Regards,
Johan Louwers. -
SQl query to remove all dbms_output statement
Hi
Can u please tell me Single SQl query to remove all dbms_output statement from package and procedure
Umesh>
Can u please tell me Single SQl query to remove all
dbms_output statement from package and procedure
If you are comfortable with scripting languages like Perl, Python, Ruby etc., then removing lines having the dbms_output statements from your files should be a trivial matter.
pratz -
SQL Query to list details by Age
Hi All,
I have a Tenant table and want the query to list all tenants in Age bracket between age 14 and 24. But since we have the mobile no of the main tenant we also want to show their record as well. In certain cases the main tenant can also
be in the age group 14 -24 and should include these tenants as well.
Below is how the view should look like. I have uploaded sample data here:
https://app.box.com/s/ky3ry6x5zk587j7nvuk76dg0ezmsv3kn
ThanksHi
Can you please provide the result that you want get according to your sample data?
It will clear what you are ask for.
* if you return
all tenants in Age bracket between age 14 and 24 then you already returned
main tenant in the age group 14 -24, since he is tenant
Ronen Ariely
[Personal Site] [Blog] [Facebook] -
SQL Query to list the "Optional reference" field of all packages in cm 2012
Guys, could you please point me to the correct view to extract the "Optional reference" property of all application? I've got a powershell script to get that from WMI, but i really am expecting a way to extract it from ConfigMgr DB if that's
available in CM Db.
Thanks,
Delphin.
Kindly mark as answer/Vote as helpful if a reply from anybody helped you in this forum. DelphinThank you torsten for helping me out here.
I've managed to come up with a query to list the Display name, package verison and optional reference property.
;WITH XMLNAMESPACES ( DEFAULT 'http://schemas.microsoft.com/SystemCenterConfigurationManager/2009/AppMgmtDigest')
select DisplayName, SDMPackageDigest.value('(/AppMgmtDigest/Application/CustomId/@ResourceId)[1]', 'nvarchar(10)') [Optional Reference]
,sdmpackageversion
from fn_ListApplicationCIs(1033)
order by DisplayName
But the problem here is, I'm looking for the value AB00001 from that XML but it actually giving me Res_631986121. Can someone help me to get the value AB00001 from that xml file?
<CustomId ResourceId="Res_631986121">AB00001</CustomId>
Kindly mark as answer/Vote as helpful if a reply from anybody helped you in this forum. Delphin -
How to write query to list all the employees of deptno 20
Hi ,
I am new to Oracle...Recently I got job.... Could you please help me....
How to write a query for
1) List all the Clerks of Deptno 20 and
2) List the emps along with their exp and whose daily salary is more than 100rsits not wrong that you ask , but this is basic question and my suggestion is to start reading some manual specially since you got job , Read oracle documentation gogole what you want if you didn't find any answer post here and we will help you .
Check this link
http://www.oracle-dba-online.com/sql/oracle_sql_tutorial.htm
http://www.w3schools.com/sql/default.asp
http://www.java2s.com/Tutorial/Oracle/CatalogOracle.htm
And you will find more & more .. create your own vmware oracle provide with learning database called XE (express edition) test it and hope this information is useful for you -
Looking for a SQL query to get all the possible Alert Messages from the Rules in a Management Pack
For reporting, I'm looking to get a SQL query of all the possible Alert Messages for Rules configured in a Management Pack (not necessarily the ones that have thrown alerts). I can do this for Monitors, but not for Rules.
The configured alert messages for the Management Pack Monitors
go like this: ManagementPack > MonitorView> RuleModule > RuleModule.Alert Message > Localized Text
The configured alert messages for the Management Pack Rules
should go something like this, but there is a missing link: ManagementPack > RuleView > RuleModule > ? Missing Link ? > Localized Text
The Rules are tied to the Module, but I don't see a connection from the RulesModule to the Alert Message that I see in the LocalizedText. The Rule names do not always equal the Alert name.
Can someone provide the missing link?Hi,
please try below powershell code to find the corresponding management pack for specific alert:
$Alert = get-scomalert | where {$_.Name -like 'Agent Proxy Not Enabled*'} | select -first 1
If ($alert.IsMonitorAlert -eq "True") {
write-host "Ths is a monitor-generated alert"
get-scommonitor -ID $Alert.MonitoringRuleID | select Enabled, DisplayName, ManagementPack
else
write-host "This is a rule-generated alert"
get-scomrule -ID $Alert.MonitoringRuleID | select Enabled, DisplayName, ManagementPack
In addition, please also refer to the below link:
http://blogs.technet.com/b/mazenahmed/archive/2011/12/02/using-powershell-to-map-opsmgr-active-alert-to-its-corresponding-rule-monitor-and-management-pack-name.aspx
Regards,
Yan Li
Regards, Yan Li
Maybe you are looking for
-
Illustrator CC crash on start - Mac OSX 10.9.2
Message Bellow - Process: Adobe Illustrator [23652] Path: /Applications/Adobe Illustrator CC/Adobe Illustrator.app/Contents/MacOS/Adobe Illustrator Identifier: com.adobe.illustrator Version: 17.1.0 (17.0.0) Code Type:
-
Strange icon appeared on iPhone4 bar
strange icon appeared on muy Iphone 4 bar, near the battery icon. it looks like a old telephone hand with buttons underneath. i wonder what it means and how it came there. My iphone is not functioning properly and i cannot download the software updat
-
Thumbnails in reverse order in Icon view
When I look at a folder full of picture thumbnails in Finder, in Icon view, and select Keep Arranged by Date Modified, or Date Created, they appear in the reverse order, with the most recent at the top. In the other views (list, cover flow etc.) they
-
"Part of the file seems to be corrupted" when downloading from iTunes Store
I have suddenly started getting this issue. It has happened once before, but after 2 retries, it worked. However, this time it refuses to work no matter how many retries, restarts, and reboots... I have looked up the error it give me on my Downloads
-
Pdf creation problem in Excel and Word
I have Windows 7 Pro and Office 2010. Up until a month ago, when I created a pdf in Excel or word, it would automatically open up so I can review. I then downloaded the trial version of Acrobat® XI Pro. When the trial version ended, I uninstalled