Query that EXCLUDES keywords?
Is it possible to create a smart album query that EXCLUDES certain keywords?
Example: I want the album to include all pictures with keywords "red", "yellow", "blue", but not include those that have keywords "red", "yellow", "blue" and "green". If it has the keyword "green" I do not want it included.
Using Aperture 1.5
You can.
This works in Aperture 1.5 and 2.1:
- Add IPTC criteria
- Choose Keyword in the first popup
- Then 'is not empty and does not include'
You're set.
Similar Messages
-
Is it possible to have a playlist that excludes the explicit songs without doing it one by one and that keeps it updated with purchases?
I want it for the kids but my computer constantly breaks and I am fed up with going through over 1000 songs every time it does!
Thanks for any advice (other than buy a new computer!)Not fully automatically, no. iTunes doesn't expose the clean/explicit status to the smart playlist system, but if you're prepared to take a few seconds to tag new purchases, say by adding the keyword Explict into the grouping field, then it will be easy to create smart playlists that exclude those tracks. I use a similar scheme to tag tracks so they they go into seperate playlists for each member of the family, E,g, a grouping of Alice/Bob will go into each of Alice's & Bob's playlists, but not Charlie's.
tt2 -
Query that only returns items that will produce a result
Thanks to Mack for his help yesterday. I would really appreciate some help from anyone who is more SQL competent than I am. I have an SQL problem that is just completely over my head. I've created a nifty tagging system for the blog, that sorts by tags and by multiple tags, check out the beta here: http://committedsardine.com/blog.cfm
When a user selects a tag, it adds it to the value list SESSION.blogTags. If the selected tag is there already, it removes it. When the list for tags pops up, I output all the tags, and show their state. You'll see what I mean if you try it.
What this leads to is the ability to select a group of tags for which there are no query results. What I want to do is only show those that will generate results and how many results they'll show. Like this, select "fluency" by itself there are 310 entries
fluency (310) | digital (234) | writing (12)
Once fluency is selected, there are 13 articles that ALSO are tagged by "digital", but none that are tagged by writing:
fluency | digital (12) | writing
I have a table called blogTagLinks, that is just for tying a tag to a blog. It lists a blogID and a tagID. Here is a sample of it for reference:
blogTagLinkID
blogID
tagID
4
2
2
5
2
3
6
2
5
39
1
18
49
1
1
42
1
9
44
1
19
47
5
14
48
1
22
54
16
22
I'm including all my sql, but the spot that I need help with is marked in red below:
<!---if URL.tg is defined, check to see if it exists in the database, then the SESSION, and either add or delete it from SESSION--->
<cfquery name="rsAllTags" datasource="">
SELECT tagsID, tagName
FROM tags
WHERE tagActive = 'y'
</cfquery>
<cfset allTags = ValueList(rsAllTags.tagsID)>
<cfif isDefined("URL.blogTags")>
<cfif ListFind(allTags, URL.blogTags) NEQ 0>
<cfif ListFind(SESSION.blogTags, URL.blogTags) NEQ 0>
<cfset SESSION.blogTags = ListDeleteAt(SESSION.blogTags, ListFind(SESSION.blogTags, URL.blogTags))>
<cfelse>
<cfset SESSION.blogTags = ListAppend(SESSION.blogTags, URL.blogTags)>
</cfif>
</cfif>
</cfif>
<!---get a list of all available tags, tags that if added to the already selected tags, will return a result--->
<cfquery name="rsAvailableTags" datasource="">
SELECT tagsID, tagName
FROM tags
WHERE tagActive = 'y'
NEED SOME STATEMENT HERE OF BLOGTAGLINKS TO DETERMINE WHAT TAGS WILL PRODUCE A RESULT
</cfquery>
<!---if searching by tags, get a list of the currently selected tags for display, the 0 returns an empty result if there are no tags--->
<cfif isDefined("SESSION.sb") AND SESSION.sb EQ "tg">
<cfquery name="rsTags" datasource="">
SELECT tags.tagName, tagsID
FROM tags
WHERE tagsID <cfif SESSION.blogTags NEQ "">IN(#SESSION.blogTags#)
<cfelse> = 0</cfif>
</cfquery>
<cfset variables.newrow = false>
</cfif>
<!---get the information for the blogs list, filtered by keyword or tag if requested--->
<cfquery name="rsBlog" datasource="">
SELECT blog.blogID,
blog.storyID,
blog.blogDate,
blogStories.storyID,
blogStories.blogTitle,
SUBSTRING(blogStories.blogBody,1,200) AS blogBody,
images.imageName
FROM blog, blogStories, images
WHERE blog.storyID = blogStories.storyID AND images.imageID = blog.photoID AND blog.blogDate < "#todayDate#" AND blog.deleted = 'n'
<cfif SESSION.sb EQ "kw">AND CONCAT(blogStories.blogBody, blogStories.blogTitle) LIKE '%#SESSION.blogKeywords#%'</cfif>
<cfif SESSION.sb EQ "tg" AND SESSION.blogTags NEQ "">
AND blog.blogID IN (
SELECT blogID
FROM blogTagLink
<cfif SESSION.blogTags NEQ "">
WHERE tagID IN(<cfqueryparam cfsqltype="cf_sql_integer" value="#SESSION.blogTags#" list="true">)
GROUP BY blogID
HAVING count(tagID) = #ListLen( SESSION.blogTags )#)
</cfif>
</cfif>
ORDER BY blog.blogDate DESC
</cfquery>There might be a single query solution but here's a query that you
will need to run for each tag in the database (cfloop over all the
tags) and will give you the number of blogs that have the selected
tags + the current tag
SELECT Count(*) AS blog_count
FROM (
SELECT blogID
FROM blogTagLink
WHERE tagID IN(<cfqueryparam cfsqltype="cf_sql_integer"
value="#SESSION.blogTags#" list="true">)
OR tagID = #currentTagID#
GROUP BY blogID
HAVING count(tagID) = #ListLen( SESSION.blogTags )#
OR count(tagID) = #ListLen( SESSION.blogTags )# + 1
) AS blogs
Mack -
Caml query to retrive keyword from rich text field
hi friends
i am using below caml query to retrieve data from title field and Rich text field(Definition)
<View>
<Query>
<Where>
<And>
<Or>
<Eq>
<FieldRef Name=\'Title\'/>
<Value Type=\'Text\'>'+letter+'</Value>
</Eq>
<Contains>
<FieldRef Name=\'Definition\' />
<Value Type=\'Note\'>'+letter+'</Value>
</Contains>
</Or>
<Neq>
<FieldRef Name=\'status\' />
<Value Type=\'Text\'>Not approved</Value>
</Neq>
</And>
</Where>
<OrderBy><FieldRef Name=\'Title\' /></OrderBy>
</Query>
</View>
this query is working fine. But it is retrieving some extra fields also which doesn't have the queried string. and even it is retrieving keyword from image urls which are present in rich text field.
Please help me to retrieve key word from plain text of rich text field.Hi,
According to your post, my understanding is that you want to use caml query to retrive keyword from rich text field
By design, when specifying a ViewFields clause, values for these fields are returned, together with a few system columns like ID, Created and Modified.
If you query rich text field, it will return the field with HTML tags.
To retrieve key word from plain text of rich text field, you need to use regular expression to remove the HTML tags.
You can use the code below:
using (SPSite site = new SPSite("http://sitename"))
using (SPWeb spWeb = site.OpenWeb())
SPList spList = spWeb.Lists.TryGetList("ListName");
SPQuery qry = new SPQuery();
if (spList != null)
qry.Query =
@" <Where>
<Contains>
<FieldRef Name='Rich_x0020_Text' />
<Value Type='Note'>caml</Value>
</Contains>
</Where>";
qry.ViewFields = @"<FieldRef Name='Title' /><FieldRef Name='Rich_x0020_Text' />";
SPListItemCollection listItems = spList.GetItems(qry);
foreach (SPListItem item in listItems)
string src = item["Rich_x0020_Text"].ToString();
Regex htmlReg = new Regex(@"<[^>]+>", RegexOptions.Compiled | RegexOptions.IgnoreCase);
src = htmlReg.Replace(src, string.Empty);
Console.WriteLine(src);
Console.ReadKey();
The result is as below:
Best Regards,
Linda Li
Linda Li
TechNet Community Support -
Create a Union query that automatically adds/contains new tables with a similar name
Dear All,
For a research project i am upscaling from an Access database to SQL server/ SQL azure since the database got far too large. Now i am quite well known with Access, but to be quite honest, I am a SQL rookey. So a lot to learn for me here.
what I need is a union query that automatically adds new research dumps to the query. All research dumps have a table name starting with TD_EXP (Table Dump _ Export). In Access VBA I simply made a loop that builds up the SQL statement, but i have no clue
how to do this within SQL Server...
So, I need the UNION Query to select * from TD_Exp_2012_06_06_15_48 UNON all the TD_Exp_XXXX_XX_XX_XX_XX that are added in the database,
Who could help me out please with a dynamic SQL statement.
Best regards Jurjenyou can use INFORMATION_SCHEMA.TABLES view for that
do like below
DECLARE @Query varchar(max)
SELECT @Query = STUFF((SELECT ' UNION ALL ' + 'SELECT * FROM ' + TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME LIKE 'TD_EXP%' FOR XML PATH('')),1,11,'')
SELECT @Query
Add one more condition as below if you want to exclude views from above
DECLARE @Query varchar(max)
SELECT @Query = STUFF((SELECT ' UNION ALL ' + 'SELECT * FROM ' + TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME LIKE 'TD_EXP%' AND TABLE_TYPE = 'BASE TABLE' FOR XML PATH('')),1,11,'')
SELECT @Query
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
NOT urgent. LOV that excludes list item that is already selected
I have a mutiple record block with a LOV item. I want the LOV to display only list items that have not been selected in the other records. The form do not commit after each record, so I cannot use a databse query to exclude the list items that have already been selected.
The only way I could think of is to go through the data block and build a LOV that excludes the list items that are in the records. This seems like a lot of work for a simple task.
Is there an easier way in doing this?
Any help will be appreciated.
- Clayton.Hello Clayton,
you don't need to commit. You could try to post your records to the database.
But make sure you do a rollback when the user doesn't want to commit.
This will release you from the 'hard work' ;-)
Bernd -
Help: How to create a query that transpose the column content?
Here, suppose that I have two tables
TAB_A:
ID TYPE
1 AA
1 AB
1 AC
2 BA
2 BB
2 BC
2 BD
I'd like to create a query that gives result as:
ID TYPE
1 AA AB AC
2 BA BB BC BD Any suggestions?
Thank you in advance.
JimmyHi
Try this:
SELECT id,
replace(LTRIM(MAX(SYS_CONNECT_BY_PATH(type,'*'))
KEEP (DENSE_RANK LAST ORDER BY curr),'*'),'*', ', ') AS type
FROM (SELECT id, type,
ROW_NUMBER() OVER (PARTITION BY id ORDER BY type) AS curr,
ROW_NUMBER() OVER (PARTITION BY id ORDER BY type) -1 AS prev
FROM tab_a)
GROUP BY id
CONNECT BY prev = PRIOR curr AND id = PRIOR id
START WITH curr = 1;
Ott Karesz
http://www.trendo-kft.hu -
Currently working on SAP B1 v8.82
I'm looking to generate a query that will give an overall report for a given customer that shows Sales Order No, Invoice No, Sales Order Total, Invoice Total, Amount Paid on Invoice, Amount Remaining on Invoice, Down Payments Available, Open on Sales Order.
I'm not sure what the best way to select the columns in bold above. Invoice Total should be self-explanatory. Amount Paid should be any down payments or applied payments on the invoice. The balance due on the invoice (which seems to be T0.DocTotal if I'm not mistaken) should = 'Invoice Total' - 'Amount Paid on Invoice'. In the Down Payments Available column I want the total amount of money on the account or on down payments that aren't tied to a Sales Order. If a client overpaid in the past for instance and there's a credit on their account, then it should contribute to this sum. Open on Sales Order should be pretty easy. I guess it's just the sum of everything that is still open on the Sales Order. I'm just not sure what the best way to sum all the un-delivered freight, tax, and line items is. Here's what my query looks like so far.
SELECT DISTINCT T4.[DocNum] [Sales Order No],
T0.DocNum [Invoice No],
T4.DocTotal [Sales Order Total]
T0.DocTotal [Amount Outstanding],
FROM OINV T0
INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry
INNER JOIN DLN1 T2 ON T1.BaseEntry = T2.DocEntry AND T1.BaseLine = T2.LineNum
INNER JOIN RDR1 T3 ON T2.BaseEntry = T3.DocEntry AND T2.BaseLine = T3.LineNum
INNER JOIN ORDR T4 ON T3.DocEntry = T4.DocEntry
INNER JOIN OSLP T5 ON T4.SlpCode = T5.SlpCode
WHERE T0.CardName Like '%%[%0]%%'
GROUP BY T4.DocNum, T0.DocNum, T0.DocTotal, T4.DocTotal
I tried doing a little searching around for queries similar to what I need, but I could find exactly what I was looking for and I'm very unfamiliar with OJDT, JDT1, and ITR1 tables which I think might be important to finding unapplied payments...Thanks. There's a few problems though.
1) It seems that OINV DocTotal != Balance Due. I'm seeing a number of invoices where there was a balance due, but we applied additional money (either we took another incoming payment and applied it or applied money from the account balance, etc.) and yet it still shows a total.
2) It's pulling incoming payments from different customers. I think this is because the table was joined based on "RCT2 T4 on T4.[DocEntry] = T3.[DocNum] and T4.[InvoiceId] = T2.[LineNum]" In one example I have 2 incoming payments 446 and 614. Both have the DocEntry 542, but one relates to A/R Invoice 542 (for a different client) while the other relates to Down Payment Invoice 542. *I was able to fix this by adding WHERE T5.CardCode = [%0]*
3) I'm going to work with this a little bit and see if I can alter it to make it work for me. Basically this query falls a little short on the following:
- Doesn't include incoming payments that aren't linked to a down payment invoice.
- Does not give the Invoice Total (I'd like to know how much of the SO was invoiced. DocTotal seems to give me Amount Invoiced - Down Payments. I'm not sure the best way to get this number. Maybe I could do the sum of each line * tax + freight)
- Does not give the outstanding amount on an invoice. The ARtotal [DocTotal] column gives me how much was owed when the invoice was created, but it doesn't tell me what is currently owed.
- Lastly it may complicate the query too much and could be left off, but it would be nice to see if they have any money from credits or incoming payments that has not been applied. Perhaps this would be easily accomplished by simply pulling in their account balance. -
Need help with query that can look data back please help.
hi guys i have a table like such
CREATE TABLE "FGL"
"FGL_GRNT_CODE" VARCHAR2(60),
"FGL_FUND_CODE" VARCHAR2(60),
"FGL_ACCT_CODE" VARCHAR2(60),
"FGL_ORGN_CODE" VARCHAR2(60),
"FGL_PROG_CODE" VARCHAR2(60),
"FGL_GRNT_YEAR" VARCHAR2(60),
"FGL_PERIOD" VARCHAR2(60),
"FGL_BUDGET" VARCHAR2(60)
)and i have a data like such
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','11','1','400');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','10','1','100');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','1','0');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','14','200');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','10','14','100');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','10','2','100');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7470','4730','02','10','2','200');I bascially need to get the total of the budget column. however its not as simple as it sound(well atleast not for me.) the totals carry over to the new period. youll noticed the you have a period column. basically what im saying is that
fgl_grant_year 10 period 1 = for account 7600 its $100 and $100 for period 2 you see 100 dollars again this is not to be added this is the carried over balance. which remains $100.
so im trying to write a query that basically does the following.
im given a period for the sake of this example lets say period 1 i get nothing else. I have to find the greates grant year grab the amount for period 14(which is the total from the previous year) and add it to the amount of the current period. in this case period 1 grnt_year 11
so the expected outcome should be $700
240055 240055 7240 4730 02 10 14 200
240055 240055 7600 4730 02 10 14 100
240055 240055 7600 4730 02 11 1 400keep in mind that im not given a year just a period.
any help that you guys can offer would be immensely appreciated. I have been trying to get this to work for over 3 days now.
finally broke down and put together this post
Edited by: mlov83 on Sep 14, 2011 8:48 PMFrank
wondering if you can help me modify this sql statement that you provided me with .
table values have been modified a bit.
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','11','00','400');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','1','100');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','1','0');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','11','1','400');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('360055','360055','7200','4730','02','10','1','400');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('360055','360055','7600','4730','02','10','1','400');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','14','200');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','10','14','100');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','14','200');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','2','100');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','11','2','600');i need to take one more thing into consideration. if the greatest year has a value on period 00 i need to ignore the period 14 and the current period total would be
the current period +(current period - greatest year 00)
hope that makes sense so in other words with the new data above. if i was querying period two of grant year 11. i would end up with $800
because the greatest year is 11 it contains a period 0 with amount of $400 so my total should be
period 2 amount $ 600
period 0 amount $ 400 - period 2 amount of $600 = 200
600+200 = $800
if i query period 1 of grant 360055 i would just end up with 800 of grnt year 10.
i have tried to modify that query you supplied to me with no luck. I have tried for several day but im embarrased to say i just can get it to do what im trying to do .
can you please help me out.
Miguel -
IN NEED OF A SCCM 2012 QUERY THAT SHOWS LAST TIME SOFTWARE WAS USED OR OPENED
Hello
I am in need of an SCCM 2012 query that shows PCs that have Visio , Adobe Professional and Visual Studio and the last time each was used or opened. I have the query below which give me the PC name and the product. Any assistance will be very helpful
select distinct SMS_R_System.NetbiosName, SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName from SMS_R_System inner join SMS_G_System_ADD_REMOVE_PROGRAMS on SMS_G_System_ADD_REMOVE_PROGRAMS.ResourceID = SMS_R_System.ResourceId where SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName
like "%adobe acrobat%pro%"
select distinct SMS_R_System.NetbiosName, SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName from SMS_R_System inner join SMS_G_System_ADD_REMOVE_PROGRAMS on SMS_G_System_ADD_REMOVE_PROGRAMS.ResourceID = SMS_R_System.ResourceId where SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName
like "%visio%" and SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName not like "%viewer%" and SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName not like "%service pack%" and SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName not like "%security
update%" and SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName not like "%hydra%" and SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName not like "%update%" and SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName not like "%MUI%" and SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName
not like "%amd%" and SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName not like "%microsoft visio%" and SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName not like "%vision%" and SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName not like "%add-in%"
select distinct SMS_R_System.NetbiosName, SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName from SMS_R_System inner join SMS_G_System_ADD_REMOVE_PROGRAMS on SMS_G_System_ADD_REMOVE_PROGRAMS.ResourceID = SMS_R_System.ResourceId where SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName
= "Microsoft Visual studio 2012 devenv" and SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName not like "%hotfix%" and SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName not like "%security%" and SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName
not like "%update%" and SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName not like "%service%"Did you create a software metering rule for each software title? if not then you need you do that first and it will take over a week before you see results.
Also keep in mind that your query will only find x86 software titles.
http://www.enhansoft.com/ -
1. How to create an explain plan with rowsource statistics for a complex query that include multiple table joins ?
When multiple tables are involved , and the actual number of rows returned is more than what the explain plan tells. How can I find out what change is needed in the stat plan ?
2. Does rowsource statistics gives some kind of understanding of Extended stats ?You can get Row Source Statistics only *after* the SQL has been executed. An Explain Plan midway cannot give you row source statistics.
To get row source statistics either set STATISTICS_LEVEL='ALL' in the session that executes theSQL OR use the Hint "gather_plan_statistics" in the SQL being executed.
Then use dbms_xplan.display_cursor
Hemant K Chitale -
Query that show total discount on A/R Invoice
Dear all,
I would like to have query that show summary of each invoice number that show 'Total of discount' ( 'Total of discount' = total of discount in line item + discount of total invoice ). Data that I would like to show on this query is as follow :
Invoice No, Invoice Date, Customer Code, Total before discount, 'Total of discount', Total Amount, Vat amount
Please kindly suggest the way to get this data.
Thanks you in advanced.
AngnamHi Angnam K,
Try This one...hope this will serve your purpose.
SELECT DocEntry, DocNum, CardCode, CardName, DocDate, [Total Before Discount] , [Totaldiscount]+ [OinvDiscount] as [Total of discount], VatSum [Total Tax] FROM (
SELECT T0.DocEntry,T0.[DocNum], T0.[DocDate], T0.[CardCode], T0.[CardName], SUM(T1.[LineTotal])[Total Before Discount],
SUM(T1.[PriceBefDi] * T1.Quantity *T1.[DiscPrcnt])/100 as [Totaldiscount]
,Case When T0.[DiscPrcnt] <> 0 Then (SUM(T1.[LineTotal])/ T0.[DiscPrcnt]) Else 0 end [OinvDiscount] ,T0.VatSum
FROM OINV T0 INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry
Group By T0.DocEntry,T0.[DocNum], T0.[DocDate], T0.[CardCode], T0.[CardName], T0.[DiscSum] ,T0.[DiscPrcnt],T0.VatSum )Sales
thanks,
Kumar
Edited by: itskumaramit on Jul 13, 2011 12:43 PM -
How could I create a query that provides a default transaction type for those transactions not categorized?
So assuming I have:
* Transactions table (with transactions)
* Categories table
* transactions_categories table - allows to allocate multiple categories (with a percentage)
- tranactionID
- categoryID
- percentageAllocation
* Usage is such that only non-personal categories have been applied through out data. So there is a lot of transactions with no categories applied
Aim:
* Want to create a query that creates a list of all the allocated amounts, so would include as columns: transaction.tDate, transaction.tTitle, categories.name, allocatedAmount(calculated from percentage * transaction amount)
BUT:
* How could I include in the query, the entries that cover all transaction that haven't been allocated, to a default category "personal", where the allocated Amount would be 100% of the transaction value
* And also (if it were possible), for transactions that have been categorized but not for the complete transaction value (say only 50% was allocated to a category), how to to cover this off to.To default the value of the category:
select IIf(IsNull(Category),"Personal",Category) as Category,IIf(IsNull(Category),"100%",PercentageAllocation
) as PercentageAllocation from [yourtable]
What do you want to put the values of these ones:
And also (if it were possible), for transactions that have been categorized but not for the complete transaction
value (say only 50% was allocated to a category), how to to cover this off to.
Fouad Roumieh -
How to improve performance of a query that is based on an xmltype table
Dear Friends,
I have a query that is pulling records from an xmltype table with 9000 rows and it is running very slow.
I am using XMLTABLE command to retreive the rows. It is taking upto 30 minutes to finish.
Would you be able to suggest how I can make it faster. Thanks.
Below is the query.....
INSERT INTO temp_sap_po_receipt_history_t
(po_number, po_line_number, doc_year,
material_doc, material_doc_item, quantity, sap_ref_doc_no_long,
reference_doc, movement_type_code,
sap_ref_doc_no, posting_date, entry_date, entry_time, hist_type)
SELECT :pin_po_number po_number,
b.po_line_number, b.doc_year,
b.material_doc, b.material_doc_item, b.quantity, b.sap_ref_doc_no_long,
b.reference_doc, b.movement_type_code,
b.sap_ref_doc_no, to_date(b.posting_date,'rrrr-mm-dd'),
to_date(b.entry_date,'rrrr-mm-dd'), b.entry_time, b.hist_type
FROM temp_xml t,
XMLTABLE(XMLNAMESPACES('urn:sap-com:document:sap:rfc:functions' AS "n0"),
'/n0:BAPI_PO_GETDETAIL1Response/POHISTORY/item'
PASSING t.object_value
COLUMNS PO_LINE_NUMBER VARCHAR2(20) PATH 'PO_ITEM',
DOC_YEAR varchar2(4) PATH 'DOC_YEAR',
MATERIAL_DOC varchar2(30) PATH 'MAT_DOC',
MATERIAL_DOC_ITEM VARCHAR2(10) PATH 'MATDOC_ITEM',
QUANTITY NUMBER(20,6) PATH 'QUANTITY',
SAP_REF_DOC_NO_LONG VARCHAR2(20) PATH 'REF_DOC_NO_LONG',
REFERENCE_DOC VARCHAR2(20) PATH 'REF_DOC',
MOVEMENT_TYPE_CODE VARCHAR2(4) PATH 'MOVE_TYPE',
SAP_REF_DOC_NO VARCHAR2(20) PATH 'REF_DOC_NO',
POSTING_DATE VARCHAR2(10) PATH 'PSTNG_DATE',
ENTRY_DATE VARCHAR2(10) PATH 'ENTRY_DATE',
ENTRY_TIME VARCHAR2(8) PATH 'ENTRY_TIME',
HIST_TYPE VARCHAR2(5) PATH 'HIST_TYPE') b;Based on response from mdrake on this thread:
Re: XML file processing into oracle
For large XML's, you can speed up the processing of XMLTABLE by using a registered schema...
declare
SCHEMAURL VARCHAR2(256) := 'http://xmlns.example.org/xsd/testcase.xsd';
XMLSCHEMA VARCHAR2(4000) := '<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb" xdb:storeVarrayAsTable="true">
<xs:element name="cust_order" type="cust_orderType" xdb:defaultTable="CUST_ORDER_TBL"/>
<xs:complexType name="groupType" xdb:maintainDOM="false">
<xs:sequence>
<xs:element name="item" type="itemType" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="id" type="xs:byte" use="required"/>
</xs:complexType>
<xs:complexType name="itemType" xdb:maintainDOM="false">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="id" type="xs:short" use="required"/>
<xs:attribute name="name" type="xs:string" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="cust_orderType" xdb:maintainDOM="false">
<xs:sequence>
<xs:element name="group" type="groupType" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="cust_id" type="xs:short" use="required"/>
</xs:complexType>
</xs:schema>';
INSTANCE CLOB :=
'<cust_order cust_id="12345">
<group id="1">
<item id="1" name="Standard Mouse">100</item>
<item id="2" name="Keyboard">100</item>
<item id="3" name="Memory Module 2Gb">200</item>
<item id="4" name="Processor 3Ghz">25</item>
<item id="5" name="Processor 2.4Ghz">75</item>
</group>
<group id="2">
<item id="1" name="Graphics Tablet">15</item>
<item id="2" name="Keyboard">15</item>
<item id="3" name="Memory Module 4Gb">15</item>
<item id="4" name="Processor Quad Core 2.8Ghz">15</item>
</group>
<group id="3">
<item id="1" name="Optical Mouse">5</item>
<item id="2" name="Ergo Keyboard">5</item>
<item id="3" name="Memory Module 2Gb">10</item>
<item id="4" name="Processor Dual Core 2.4Ghz">5</item>
<item id="5" name="Dual Output Graphics Card">5</item>
<item id="6" name="28inch LED Monitor">10</item>
<item id="7" name="Webcam">5</item>
<item id="8" name="A3 1200dpi Laser Printer">2</item>
</group>
</cust_order>';
begin
dbms_xmlschema.registerSchema
schemaurl => SCHEMAURL
,schemadoc => XMLSCHEMA
,local => TRUE
,genTypes => TRUE
,genBean => FALSE
,genTables => TRUE
,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
execute immediate 'insert into CUST_ORDER_TBL values (XMLTYPE(:INSTANCE))' using INSTANCE;
end;
SQL> desc CUST_ORDER_TBL
Name Null? Type
TABLE of SYS.XMLTYPE(XMLSchema "http://xmlns.example.org/xsd/testcase.xsd" Element "cust_order") STORAGE Object-relational TYPE "cust_orderType222_T"
SQL> set autotrace on explain
SQL> set pages 60 lines 164 heading on
SQL> col cust_id format a8
SQL> select extract(object_value,'/cust_order/@cust_id') as cust_id
2 ,grp.id as group_id, itm.id as item_id, itm.inm as item_name, itm.qty as item_qty
3 from CUST_ORDER_TBL
4 ,XMLTABLE('/cust_order/group'
5 passing object_value
6 columns id number path '@id'
7 ,item xmltype path 'item'
8 ) grp
9 ,XMLTABLE('/item'
10 passing grp.item
11 columns id number path '@id'
12 ,inm varchar2(30) path '@name'
13 ,qty number path '.'
14 ) itm
15 /
CUST_ID GROUP_ID ITEM_ID ITEM_NAME ITEM_QTY
12345 1 1 Standard Mouse 100
12345 1 2 Keyboard 100
12345 1 3 Memory Module 2Gb 200
12345 1 4 Processor 3Ghz 25
12345 1 5 Processor 2.4Ghz 75
12345 2 1 Graphics Tablet 15
12345 2 2 Keyboard 15
12345 2 3 Memory Module 4Gb 15
12345 2 4 Processor Quad Core 2.8Ghz 15
12345 3 1 Optical Mouse 5
12345 3 2 Ergo Keyboard 5
12345 3 3 Memory Module 2Gb 10
12345 3 4 Processor Dual Core 2.4Ghz 5
12345 3 5 Dual Output Graphics Card 5
12345 3 6 28inch LED Monitor 10
12345 3 7 Webcam 5
12345 3 8 A3 1200dpi Laser Printer 2
17 rows selected.Need at least 10.2.0.3 for performance i.e. to avoid COLLECTION ITERATOR PICKLER FETCH in execution plan...
On 10.2.0.1:
Execution Plan
Plan hash value: 3741473841
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 24504 | 89M| 873 (1)| 00:00:11 |
| 1 | NESTED LOOPS | | 24504 | 89M| 873 (1)| 00:00:11 |
| 2 | NESTED LOOPS | | 3 | 11460 | 805 (1)| 00:00:10 |
| 3 | TABLE ACCESS FULL | CUST_ORDER_TBL | 1 | 3777 | 3 (0)| 00:00:01 |
|* 4 | INDEX RANGE SCAN | SYS_IOT_TOP_774117 | 3 | 129 | 1 (0)| 00:00:01 |
| 5 | COLLECTION ITERATOR PICKLER FETCH| XMLSEQUENCEFROMXMLTYPE | | | | |
Predicate Information (identified by operation id):
4 - access("NESTED_TABLE_ID"="CUST_ORDER_TBL"."SYS_NC0000900010$")
filter("SYS_NC_TYPEID$" IS NOT NULL)
Note
- dynamic sampling used for this statementOn 10.2.0.3:
Execution Plan
Plan hash value: 1048233240
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 17 | 132K| 839 (0)| 00:00:11 |
| 1 | NESTED LOOPS | | 17 | 132K| 839 (0)| 00:00:11 |
| 2 | MERGE JOIN CARTESIAN | | 17 | 131K| 805 (0)| 00:00:10 |
| 3 | TABLE ACCESS FULL | CUST_ORDER_TBL | 1 | 3781 | 3 (0)| 00:00:01 |
| 4 | BUFFER SORT | | 17 | 70839 | 802 (0)| 00:00:10 |
|* 5 | INDEX FAST FULL SCAN| SYS_IOT_TOP_56154 | 17 | 70839 | 802 (0)| 00:00:10 |
|* 6 | INDEX UNIQUE SCAN | SYS_IOT_TOP_56152 | 1 | 43 | 2 (0)| 00:00:01 |
|* 7 | INDEX RANGE SCAN | SYS_C006701 | 1 | | 0 (0)| 00:00:01 |
Predicate Information (identified by operation id):
5 - filter("SYS_NC_TYPEID$" IS NOT NULL)
6 - access("SYS_NTpzENS1H/RwSSC7TVzvlqmQ=="."NESTED_TABLE_ID"="SYS_NTnN5b8Q+8Txi9V
w5Ysl6x9w=="."SYS_NC0000600007$")
filter("SYS_NC_TYPEID$" IS NOT NULL AND
"NESTED_TABLE_ID"="CUST_ORDER_TBL"."SYS_NC0000900010$")
7 - access("SYS_NTpzENS1H/RwSSC7TVzvlqmQ=="."NESTED_TABLE_ID"="SYS_NTnN5b8Q+8Txi9V
w5Ysl6x9w=="."SYS_NC0000600007$")
Note
- dynamic sampling used for this statement----------------------------------------------------------------------------------------------------------
-- CLEAN UP
DROP TABLE CUST_ORDER_TBL purge;
exec dbms_xmlschema.deleteschema('http://xmlns.example.org/xsd/testcase.xsd'); -
SCCM 2012 QUERY THAT SHOWS SOFTWARE INSTALLED AND LAST TIME IT WAS USED OR OPENED
Hello
I am in need of an SCCM 2012 query that shows PCs that have Visio , Adobe Professional and Visual Studio and the last time each was used or opened. I have the query below which give me the PC name and the product. Any assistance will be very helpful
select distinct SMS_R_System.NetbiosName, SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName from SMS_R_System inner join SMS_G_System_ADD_REMOVE_PROGRAMS on SMS_G_System_ADD_REMOVE_PROGRAMS.ResourceID = SMS_R_System.ResourceId where SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName
like "%adobe acrobat%pro%"
select distinct SMS_R_System.NetbiosName, SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName from SMS_R_System inner join SMS_G_System_ADD_REMOVE_PROGRAMS on SMS_G_System_ADD_REMOVE_PROGRAMS.ResourceID = SMS_R_System.ResourceId where SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName
like "%visio%" and SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName not like "%viewer%" and SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName not like "%service pack%" and SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName not like "%security
update%" and SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName not like "%hydra%" and SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName not like "%update%" and SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName not like "%MUI%" and SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName
not like "%amd%" and SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName not like "%microsoft visio%" and SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName not like "%vision%" and SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName not like "%add-in%"
select distinct SMS_R_System.NetbiosName, SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName from SMS_R_System inner join SMS_G_System_ADD_REMOVE_PROGRAMS on SMS_G_System_ADD_REMOVE_PROGRAMS.ResourceID = SMS_R_System.ResourceId where SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName
= "Microsoft Visual studio 2012 devenv" and SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName not like "%hotfix%" and SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName not like "%security%" and SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName
not like "%update%" and SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName not like "%service%See me reply to your other post with the exact same details, in the CM07 forum.
http://www.enhansoft.com/
Maybe you are looking for
-
Payroll Data Extraction - 0HR_PY_1 and BIWMONTH
Hi, I'm hoping someone can provide some clarification on an issue with a payroll data extractor please. I've searched the forums, and looked at the Business Content documentation, but I'm still not clear on one point. The extractor 0HR_PY_1 (Payroll
-
App Manager gives Download Error msg
Hello, Just signed up for the cloud service. i installed the Application Manager. as soon as it opens, it gives a "download error. Please contact customer support" message. there is no other infomation on the screen and the app window is blank. I
-
Camera Raw 7.3 Update replaced Photoshop CS6 Standard with CS6 Extended Trial version
How do I get back to Photoshop CS6 Standard edition after Camera Raw 7.3 update? After installing the Camera Raw update photoshop now runs as the Trial version of Photoshop Extended.
-
Hi, I have tree on page and would like to deselect selected node without selecting any other node in the tree i.e. no node selected in tree. Any suggestion, how can it be achieved. Thanks.
-
Hi I would like to create a table where I include a reference to year and month, something like this (which I know don't work); create table abc_(sysdate, 'YYYY-MM') Is it all possible without a mile of code :-) Rgds Robert