Search Results

Search found 17583 results on 704 pages for 'query analyzer'.

Page 25/704 | < Previous Page | 21 22 23 24 25 26 27 28 29 30 31 32  | Next Page >

  • complicated sql query !!

    - by user507779
    LookupTable: userid, mobileid, startedate, enddate , owner 1 , 1 , 12-12-2000, 01-01-2001, asd 2 , 2 , 12-12-2000, 01-01-2001, dgs 3 , 3 , 02-01-2001, 01-01-2002, sdg 4 , 4 , 12-12-2000, 01-01-2001, sdg UserInfoTable: userid, firstname, lastname, address 1 , tom , do , test 2 , sam , smith , asds 3 , john , saw , asdasda 4 , peter , winston , near by Mobile: Mobileid, Name , number, imeinumber 1 , apple , 123 , 1111111 2 , nokia , 456 , 2222222 3 , vodafone , 789 , 3333333 CallLogs: id , Mobileid, callednumbers (string), date , totalduration 1 , 1 , 123,123,321 , 13-12-2000 , 30 2 , 1 , 123,123,321 , 14-12-2000 , 30 3 , 2 , 123,123,321 , 13-12-2000 , 30 4 , 2 , 123,123,321 , 14-12-2000 , 30 5 , 3 , 123,123,321 , 13-12-2000 , 30 6 , 3 , 123,123,321 , 14-12-2000 , 30 1 , 1 , 123,123,321 , 13-01-2002 , 30 2 , 1 , 123,123,321 , 14-01-2002 , 30 I want a query which will return me the following: firstname, lastname, mobile.name as mobilename, callednumbers (as concatinated strings from different rows in CallLogs table) and need it for year 2000 example: firstname, lastname, mobilename, callednumbers tom , do , apple , 123,123,321, 123,123,321 sam , smith , nokia , 123,123,321, 123,123,321 peter , winston , apple , 123,123,321, 123,123,321 any help will be highly appreciated...

    Read the article

  • Query multiple custom taxonomy terms in Wordpress 2.8?

    - by thechrisvoth
    I created a custom taxonomy named 'technologies' but cannot query multiple terms like I can with categories or tags. These querys DO work: query_posts('tag=goldfish,airplanes'); query_posts('technologies=php'); However, neither of the following work correctly: query_posts('technologies=php,sql'); query_posts('technologies=php&technologies=sql'); My objective: Show all posts with a technology of 'php' and all posts with a technology of 'sql' Any ideas? Is this even possible? Thanks!

    Read the article

  • Comparing COUNT values within a query?

    - by outsyncof
    I have the following tables in a relation: person(ssn,sex) employment(ssn,workweeksperyear) assume ssn is a key. My assignment was to do this: Given as input the number of weeks per year a person has worked, determine whether there are more males than females who work more weeks than the input value. SELECT COUNT(sex) AS NumMales FROM person WHERE sex = 'Male' AND ssn IN (SELECT ssn FROM employment WHERE workweeksperyear > 48); The above query gets me the number of males for an input value and I could do the same for number of females but how do I compare the 2 results? Any help will be greatly appreciated!

    Read the article

  • Mysql query different group by

    - by solomongaby
    Hello i have a products table that contains normal products and configurable product It has a basic stucture of: id name price configurable ('yes', 'no') id_configuration Normal products have configurable no and 0 as id configuration, and configurable products have it set to yes and have the same id_configuration value. The current query is: SELECT `products`.* FROM `products`, `categories`, `product_categories` WHERE `categories`.`id` = 23 AND `products`.`id` = `product_categories`.`id_product` AND `categories`.`id` = `product_categories`.`id_category` AND `products`.`active` = 'yes' AND ORDER BY `pos_new` ASC, `created` DESC LIMIT 0,20 I was wondering if there is a way to group by id_configuration, but only for the configurable products. The reason is that i want only one of the configuration products to show in search. I was thinking i could do a join, but was wondering if there is a way to do some kind of special group by. For example for configurable yes the field should be id_configuration otherwise it should be the id field Thanks a lot for any sugestions

    Read the article

  • Combine query results from one table with the defaults from another

    - by pulegium
    This is a dumbed down version of the real table data, so may look bit silly. Table 1 (users): id INT username TEXT favourite_food TEXT food_pref_id INT Table 2 (food_preferences): id INT food_type TEXT The logic is as follows: Let's say I have this in my food preference table: 1, 'VEGETARIAN' and this in the users table: 1, 'John', NULL, 1 2, 'Pete', 'Curry', 1 In which case John defaults to be a vegetarian, but Pete should show up as a person who enjoys curry. Question, is there any way to combine the query into one select statement, so that it would get the default from the preferences table if the favourite_food column is NULL? I can obviously do this in application logic, but would be nice just to offload this to SQL, if possible. DB is SQLite3...

    Read the article

  • optional search parameters in sql query and rows with null values

    - by glenn.danthi
    Ok here is my problem : Before i start the description, let me to tell you that I have googled up a lot and I am posting this question for a good optimal solution :) i am building a rest service on WCF to get userProfiles... the user can filter userProfiles by giving something like userProfiles?location=London now i have the following method GetUserProfiles(string firstname, string lastname, string age, string location) the sql query string i built is: select firstname, lastname, .... from profiles where (firstName like '%{firstname}%') AND (lastName like '%{lastName}%') ....and so on with all variables being replaced by string formatter. Problem with this is that it filters any row having firstname, lastname, age or location having a null value.... doing something like (firstName like '%{firstName}%' OR firstName IS NULL) would be tedious and the statement would become unmaintanable! (in this example there are only 4 arguments, but in my actual method there are 10) What would be the best solution for this?....How is this situation usually handled? Database used : MySql

    Read the article

  • How can I perform a web query in C# similar to the Data > Import External Data > New Web Query in Mi

    - by TNT
    I need to pull data from a table on a website. I can easily do this in VBA using the Web Query, but I need to do this in C#. I'm just having some trouble figuring out how to properly convert the code. I got something close, but it's returning HTML with the data. I just want the data. Any help would be great. The block of code giving me issues is below: Private Function GetData(ByVal theURL As String, ByVal theRow As Integer, ByVal thePosition As Integer, ByVal theColumn As String, ByVal theTable As Integer) With ActiveSheet.QueryTables.Add(Connection:="URL;" + theURL, Destination:=Sheet2.Range(theColumn & theRow + 1)) .Name = "op?s=" + Mid(theURL, thePosition + 1) + "_1" .PreserveFormatting = True .AdjustColumnWidth = True .WebTables = theTable .Refresh BackgroundQuery:=False End With End Function

    Read the article

  • Recursive query question - break rows into columns?

    - by Stew
    I have a table "Families", like so FamilyID PersonID Relationship ----------------------------------------------- F001 P001 Son F001 P002 Daughter F001 P003 Father F001 P004 Mother F002 P005 Daughter F002 P006 Mother F003 P007 Son F003 P008 Mother and I need output like FamilyID PersonID Father Mother ------------------------------------------------- F001 P001 P003 P004 F001 P002 P003 P004 F001 P003 F001 P004 F002 P005 P006 F002 P006 F003 P007 P008 F003 P008 In which the PersonID of the Father and Mother for a given PersonID are listed (if applicable) in separate columns. I know this must be a relatively trivial query to write (and therefore to find instructions for), but I can't seem to come up with the right search terms. Searching "SQL recursive queries" has gotten me closest, but I can't quite translate those methods to what I'm trying to do here. I'm trying to learn, so multiple methods are welcome, as is vocabulary I should read up on. Thanks!

    Read the article

  • MySQL Query order by numer of rows?

    - by Clemens
    hi, i have a mysql table for votes. there's am id, a project_id and a vote field (which is 1 if a specific project is voted). now i want to generate a ranking from those entries. is there a way to get the number of votes for each project_id and automatically sort the entries by the number of TRUE votes of a project with a single mysql query? Or do you know a php way? e.g. ID - Project ID - Vote 1 - 2 - 1 2 - 2 - 1 3 - 1 - 1 == Project Nr. 2 has 2 Votes Project Nr. 1 has 1 Vote Thanks in advance!

    Read the article

  • More strict query yields more results?

    - by Mark
    I've got a query that looks like this affiliates = User.objects.annotate(referral_count=Count('referrals')).filter(referral_count__gt=0) But when I restrict it more by adding referrals__user__date_joined__gt=start_date to the filter, I get even higher referral counts. I'm trying to count the number of people a user has referred within a time period. The relevant model looks like this: class Profile(models.Model): user = models.ForeignKey(User, unique=True, related_name='profile') referred_by = models.ForeignKey(User, null=True, blank=True, related_name='referrals') In contrast, when I try it like this: affiliates = User.objects \ .exclude(referrals__user__date_joined__lte=sd, referrals__user__date_joined__gt=ed) \ .annotate(referral_count=Count('referrals')) \ .filter(referral_count__gt=0) The exclude statement seems to do nothing... the counts don't change (should be 0 if no referred users have joined within that time period, but it isn't).

    Read the article

  • LINQ to XML query

    - by ile
    Here I had very similar xml structure, but now I have this: <Fields> <Company>My Company</Company> <Address2>Villa at beach</Address2> <Email2>[email protected]</Email2> <Mobile>333-888</Mobile> <ContactMethod>Facebook</ContactMethod> </Fields> And now I need the same output as on the given link: Company: My Company Address2: Villa at beach Email2: [email protected] What would be the query for it? Thanks, Ile

    Read the article

  • Using a RegEx in a SQL Query

    - by Jim B
    Hey Everyone, Here's the situation I'm in: We have a field in our database that contains a 3 digit number, surrounded by some text. This number is actually a PK in another table, and I need to extract this out so I can implement a proper FK relationship. Here's an example of what would currently reside in the column: Some Text Goes Here - (305) Followed By Some More Text So, what I'm looking to do is extract the '305' from the column, and hopefully end up with a result that looks something like this (pseudo code) SELECT <My Extracted Value>, Original Column Text, Id FROM dbo.MyTable It seems to me that using a Regex match in my query is the most effective way to do this. Can anybody point me in the right direction?

    Read the article

  • Long-running Database Query

    - by JamesMLV
    I have a long-running SQL Server 2005 query that I have been hoping to optimize. When I look at the actual execution plan, it says a Clustered Index Seek has 66% of the cost. Execuation Plan Snippit: <RelOp AvgRowSize="31" EstimateCPU="0.0113754" EstimateIO="0.0609028" EstimateRebinds="0" EstimateRewinds="0" EstimateRows="10198.5" LogicalOp="Clustered Index Seek" NodeId="16" Parallel="false" PhysicalOp="Clustered Index Seek" EstimatedTotalSubtreeCost="0.0722782"> <OutputList> <ColumnReference Database="[wf_1]" Schema="[dbo]" Table="[Indices]" Alias="[I]" Column="quoteDate" /> <ColumnReference Database="[wf_1]" Schema="[dbo]" Table="[Indices]" Alias="[I]" Column="price" /> <ColumnReference Database="[wf_1]" Schema="[dbo]" Table="[Indices]" Alias="[I]" Column="tenure" /> </OutputList> <RunTimeInformation> <RunTimeCountersPerThread Thread="0" ActualRows="1067" ActualEndOfScans="1" ActualExecutions="1" /> </RunTimeInformation> <IndexScan Ordered="true" ScanDirection="FORWARD" ForcedIndex="false" NoExpandHint="false"> <DefinedValues> <DefinedValue> <ColumnReference Database="[wf_1]" Schema="[dbo]" Table="[Indices]" Alias="[I]" Column="quoteDate" /> </DefinedValue> <DefinedValue> <ColumnReference Database="[wf_1]" Schema="[dbo]" Table="[Indices]" Alias="[I]" Column="price" /> </DefinedValue> <DefinedValue> <ColumnReference Database="[wf_1]" Schema="[dbo]" Table="[Indices]" Alias="[I]" Column="tenure" /> </DefinedValue> </DefinedValues> <Object Database="[wf_1]" Schema="[dbo]" Table="[Indices]" Index="[_dta_index_Indices_14_320720195__K5_K2_K1_3]" Alias="[I]" /> <SeekPredicates> <SeekPredicate> <Prefix ScanType="EQ"> <RangeColumns> <ColumnReference Database="[wf_1]" Schema="[dbo]" Table="[Indices]" Alias="[I]" Column="HedgeProduct" ComputedColumn="true" /> </RangeColumns> <RangeExpressions> <ScalarOperator ScalarString="(1)"> <Const ConstValue="(1)" /> </ScalarOperator> </RangeExpressions> </Prefix> <StartRange ScanType="GE"> <RangeColumns> <ColumnReference Database="[wf_1]" Schema="[dbo]" Table="[Indices]" Alias="[I]" Column="tenure" /> </RangeColumns> <RangeExpressions> <ScalarOperator ScalarString="[@StartMonth]"> <Identifier> <ColumnReference Column="@StartMonth" /> </Identifier> </ScalarOperator> </RangeExpressions> </StartRange> <EndRange ScanType="LE"> <RangeColumns> <ColumnReference Database="[wf_1]" Schema="[dbo]" Table="[Indices]" Alias="[I]" Column="tenure" /> </RangeColumns> <RangeExpressions> <ScalarOperator ScalarString="[@EndMonth]"> <Identifier> <ColumnReference Column="@EndMonth" /> </Identifier> </ScalarOperator> </RangeExpressions> </EndRange> </SeekPredicate> </SeekPredicates> </IndexScan> </RelOp> From this, does anyone see an obvious problem that would be causing this to take so long? Here is the query: (SELECT quotedate, tenure, price, ActualVolume, HedgePortfolioValue, Price AS UnhedgedPrice, ((ActualVolume*Price - HedgePortfolioValue)/ActualVolume) AS HedgedPrice FROM ( SELECT [quoteDate] ,[price] , tenure ,isnull(wf_1.[Risks].[HedgePortValueAsOfDate2](1,tenureMonth,quotedate,price),0) as HedgePortfolioValue ,[TotalOperatingGasVolume] as ActualVolume FROM [wf_1].[dbo].[Indices] I inner join ( SELECT DISTINCT tenureMonth FROM [wf_1].[Risks].[KnowRiskTrades] WHERE HedgeProduct = 1 AND portfolio <> 'Natural Gas Hedge Transactions' ) B ON I.tenure=B.tenureMonth inner join ( SELECT [Month],[TotalOperatingGasVolume] FROM [wf_1].[Risks].[ActualGasVolumes] ) C ON C.[Month]=B.tenureMonth WHERE HedgeProduct = 1 AND quoteDate>=dateadd(day, -3*365, tenureMonth) AND quoteDate<=dateadd(day,-3,tenureMonth) )A )

    Read the article

  • how to query with child relations to same table and order this correctly

    - by robertpnl
    Hi, Take this table: id name sub_id --------------------------- 1 A (null) 2 B (null) 3 A2 1 4 A3 1 The sub_id column is a relation to his owm table, to column ID. subid --- 0:1 --- id Now I have the problem to make a correctly SELECT query to show that the child rows (which sub_id is not null) directly selected under his parent row. So this must be a correctly order: 1 A (null) 3 A2 1 4 A3 1 2 B (null) A normal SELECT order the id. But how or which keyword help me to order this correctly? JOIN isn't possible I think because I want to get all the rows seperated. Because the rows will be displayed on a Gridview (ASP.Net) with EntityDataSource but the child rows must be displayed directly under his parent. Thank you.

    Read the article

  • Complicated MySQL query?

    - by Scott
    I have two tables: RatingsTable that contains a ratingname and a bit whether it is a positive or negative rating: Good 1 Bad 0 Fun 1 Boring 0 FeedbackTable that contains feedback on things...the person rating, the rating and the thing rated. The feedback can be determined if it's a positive or negative rating based on RatingsTable. Jim Chicken Good Jim Steak Bad Ted Waterskiing Fun Ted Hiking Fun Nancy Hiking Boring I am trying to write an efficient MySQL query for the following: On a page, I want to display the the top 'things' that have the highest proportional positive ratings. I want to be sure that the items from the feedback table are unique...meaning, that if Jim has rated Chicken Good 20 times...it should only be counted once. At some point I will want to require a minimum number of ratings (at least 10) to be counted for this page as well. I'll want to to do the same for highest proportional negative ratings, but I am sure I can tweak the one for positive accordingly.

    Read the article

  • SQL query not taking values more than 2100

    - by user175084
    SELECT MachineID, MachineName, count(ID) as Total, sum(Size) as TotalSize FROM Files join Machines on Files.MachineID = Machines.MachineID Where Files.MachineID In(sql.Append(string.Format("@MachineId{0}", i)); group by Files.MachineID,MachineName now when the machinId count is less than 2100 the query is performed and if it machines go above 2100 an error is thrown Error: The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Too many parameters were provided in this RPC request. The maximum is 2100. how do i make increase the limit or just avoid getting this error.. and put values in gridview thanks..

    Read the article

  • Help Forming An SQL Query That Selects The Max Difference Of Two Fields

    - by Frank
    I'm trying to select a record with the most effective votes. Each record has an id, the number of upvotes (int) and the number of downvotes (int) in a MySQL database. I know basic update, select, insert queries but I'm unsure of how to form a query that looks something like: SELECT * FROM topics WHERE MAX(topic.upvotes - topic.downvotes). Please excuse my made up SQL. The tutorials on SQL I find on the internet cover very basic stuff. Does anyone recommend a good book on this subject?

    Read the article

  • Can't get values from Sqlite DB using query

    - by Sana Joseph
    I used sqlite to populate a DB with some Tables in it. I made a function at another javascript page that executes the database & selects some values from the table. Javascript: function GetSubjectsFromDB() { tx.executeSql('SELECT * FROM Subjects', [], queryNSuccess, errorCB); } function queryNSuccess(tx, results) { alert("Query Success"); console.log("Returned rows = " + results.rows.length); if (!results.rowsAffected) { console.log('No rows affected!'); return false; } console.log("Last inserted row ID = " + results.insertId); } function errorCB(err) { alert("Error processing SQL: "+err.code); } Is there some problem with this line ? tx.executeSql('SELECT * FROM Subjects', [], queryNSuccess, errorCB); The queryNSuccess isn't called, neither is the errorCB so I don't know what's wrong.

    Read the article

  • MSSql Query solution cum Suggestion Required

    - by Nirmal
    Hello All... I have a following scenario in my MSSql 2005 database. zipcodes table has following fields and value (just a sample): zipcode latitude longitude ------- -------- --------- 65201 123.456 456.789 65203 126.546 444.444 and "place" table has following fields and value : id name zip latitude longitude -- ---- --- -------- --------- 1 abc 65201 NULL NULL 2 def 65202 NULL NULL 3 ghi 65203 NULL NULL 4 jkl 65204 NULL NULL Now, my requirement is like I want to compare my zip codes of "place" table and update the available latitude and longitude fields from "zipcode" table. And there are some of the zipcodes which has no entry in "zipcode" table, so that should remain null. And the major issue is like I have more then 50,00,000 records in my db. So, query should support this feature. I have tried some of the solutions but unfortunately not getting proper output. Any help would be appreciated...

    Read the article

  • ASP Classic Named Parameter in Paramaterized Query: Must declare the scalar variable

    - by My Alter Ego
    I'm trying to write a parameterized query in ASP Classic, and it's starting to feel like i'm beating my head against a wall. I'm getting the following error: Must declare the scalar variable "@something". I would swear that is what the hello line does, but maybe i'm missing something... <% OPTION EXPLICIT %> <!-- #include file="../common/adovbs.inc" --> <% Response.Buffer=false dim conn,connectionString,cmd,sql,rs,parm connectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Data Source=.\sqlexpress;Initial Catalog=stuff" set conn = server.CreateObject("adodb.connection") conn.Open(connectionString) set cmd = server.CreateObject("adodb.command") set cmd.ActiveConnection = conn cmd.CommandType = adCmdText cmd.CommandText = "select @something" cmd.NamedParameters = true cmd.Prepared = true set parm = cmd.CreateParameter("@something",advarchar,adParamInput,255,"Hello") call cmd.Parameters.append(parm) set rs = cmd.Execute if not rs.eof then Response.Write rs(0) end if %>

    Read the article

  • Help needed in AdventureWorks in a sql query.

    - by vaibhav
    I was just playing with adventureworks database in sqlserver. I got stuck in a query. I wanted to Select all titles from HumanResources.Employee which are either 'Male' or 'Female' but not both. i.e if title Accountant is Male and Female both I want to leave that title. I need only those titles where Gender is either Male or Female. I have done this till yet. select distinct(title) from humanresources.employee where gender='M' select distinct(title) from humanresources.employee where gender='F' Probably a join between these two queries, would work. But If you have any other solution, please let me know. It is not a homework. :) Thanks in advance.

    Read the article

  • Query a Hibernate many-to-many association

    - by Perry Hoekstra
    In Hibernate HQL, how would you query through a many-to-many association. If I have a Company with multiple ProductLines and other companies can offer these same product lines, I have a Company entity, a ProductLine entity and an association table CompanyProductLine. In SQL, I can get what I need like this: select * from company c where c.companyId in (select companyId from companyProductLine cpl, productline pl where cpl.productLineId = pl.productLineId and pl.name= 'some value'); My problem sees to lie with the association I defined in the Company.hbm.xml file: <set name="productLines" cascade="save-update" table="CompanyProductLine"> <key column="companyId"/> <many-to-many class="com.foo.ProductLine" column="productLineId" /> </set> Any HQL I seem to come up with will throw a: 'expecting 'elements' or 'indices"' Hibernate exception. Thoughts on what the proper HQL would be?

    Read the article

  • Any way to optimize this MySQL query?

    - by manyxcxi
    My table looks like this: `MyDB`.`Details` ( `id` bigint(20) NOT NULL, `run_id` int(11) NOT NULL, `element_name` varchar(255) NOT NULL, `value` text, `line_order` int(11) default NULL, `column_order` int(11) default NULL ); I have the following SELECT statement in a stored procedure SELECT RULE ,TITLE ,SUM(IF(t.PASSED='Y',1,0)) AS PASS ,SUM(IF(t.PASSED='N',1,0)) AS FAIL FROM ( SELECT a.line_order ,MAX(CASE WHEN a.element_name = 'PASSED' THEN a.`value` END) AS PASSED ,MAX(CASE WHEN a.element_name = 'RULE' THEN a.`value` END) AS RULE ,MAX(CASE WHEN a.element_name = 'TITLE' THEN a.`value` END) AS TITLE FROM Details a WHERE run_id = runId GROUP BY line_order ) t GROUP BY RULE, TITLE; *runId is an input parameter to the stored procedure. This query takes about 14 seconds to run. The table has 214856 rows, and the particular run_id I am filtering on has 162204 records. It's not on a super high power machine, but I feel like I could be doing this more efficiently. My main goal is to summarize by Rule and Title and show Pass and Fail count columns.

    Read the article

  • Android quotes within an sql query string

    - by miannelle
    I want to perform a query like the following: uvalue = EditText( some user value ); p_query = "select * from mytable where name_field = '" + uvalue + "'" ; mDb.rawQuery( p_query, null ); if the user enters a single quote in their input it crashes. If you change it to: p_query = "select * from mytable where name_field = \"" + uvalue + "\"" ; it crashes if the user enters a double quote in their input. and of course they could always enter both single and double quotes.

    Read the article

  • SQL Query over three different tables

    - by choise
    i got three tables CATS id name ------------------------------ 1 category1 2 category2 3 category3 4 category4 PRODUCT id name ------------------------------ 1 product1 2 product2 ZW-CAT-PRODUCT id_cats id_product ------------------------------ 1 1 3 1 4 2 now i want to get my products and their categories product1 => category1,category3 product2 => category4 is there a way to get this array (or object or something) with one mysql query? i tried a bit with JOINS, but it seems thats this is not exactly what i need, or? currently i'm using 3 querys (i think thats too much). any suggestions?

    Read the article

< Previous Page | 21 22 23 24 25 26 27 28 29 30 31 32  | Next Page >