w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Which where clauses in LINQ are converted to where clauses in a database query
Here is the MSDN page detailing which methods LINQ to SQL supports. You will not be able to use your own method calls inside of the expression tree, as LINQ to SQL does not understand how to convert the methods into SQL. Some ORMs (e.g. NHibernate) allow you to define your own generators for generating SQL (HQL in NHibernates case) for your own methods, I do not believe L2S supports this.

Categories : C#

mysql multiple IN clauses linked by AND clauses in the same field
You are correct, you'll need one of two queries... Your choice of preference. One version is to use multiple aliases, another is based on counts.. Personally, I prefer the multiple joins as: SELECT PR.* FROM vprice_range PR JOIN versiontrim Windows on PR.Version_ID = Windows.Version_ID AND Windows.Trim_ID IN ( 139, 152, 237, 265, 266 ) JOIN versiontrim HasAir on PR.Version_ID = HasAir.Version_ID AND HasAir.Trim_ID IN ( 39 ) JOIN versiontrim AirBags on PR.Version_ID = AirBags.Version_ID AND AirBags.Trim_ID IN ( 45, 55, 154 ) group by PR.Version_ID Your group by on version, but based on SQL engine (MySQL, SQL-Serv

Categories : Mysql

Google Plus share on ios directs to web page with broken links in share and cancel button
Something must be wrong with your google plus api setup. Google Plus is trying to reopen your app using a URL scheme that looks something like youdefinethis://somethingtodoinyourapp If you have setup google plus to use a specific url scheme to reopen your app, you need to define this same scheme in your project settings under Info -> URL Types. This is a hard problem to solve because of the lack of information you can give us without risking your privacy. Did you complete all the instructions that are listed here?: https://developers.google.com/+/mobile/ios/getting-started

Categories : IOS

How can I share share read/write access to a file within the same process, but forbid it externally?
Files are generally not for multi-user interactions such as this. A database is what is needed here. Then the data you need written can be saved to the database and all the synchronous handling would now be the databases responsibility. If you still require a file, after the data has been input, it would be an idea to generate the file when needed based off the database data.

Categories : C

Facebook Doesn't appear on share windows when trying to share an Image
after correcting my childish mistake (see EDIT part in question) and Using this code snippet I finally solved this problem. if anybody knows whats the difference between using contentValue and my approach please share that with me.

Categories : Android

Google plus share button callback (when share is succeded)
https://developers.google.com/+/web/share/ onendinteraction function(jsonParam) If specified, this function is called when the interaction bubble disappears. You can use this callback function to modify your page, such as resuming a video, when the bubble closes. This function accepts a single parameter, which is identical in structure to the parameter passed to onstartinteraction.

Categories : Javascript

Is there any way to share on google plus stream, without entering to share dialog ..?
Too low of a reputation to comment, but check out this answer Where it states UPDATE 3: Google just announced Google+ History. You can use it to write "moments" (which are private by default) but can then be made public by sharing them directly to your stream and/or your profile. One of the moment types is CommentActivity.

Categories : Iphone

WHERE clauses with OR
Using Arel: t = Post.arel_table Post.where(t[:start_date].eq(start_date..end_date).or(t[:end_date].eq(start_date..end_date))) Or Post.where('start_date BETWEEN (:start_date) AND (:end_date) OR end_date BETWEEN (:start_date) AND (:end_date)', :start_date => (start_date..end_date), :end_date => (start_date..end_date))

Categories : Ruby On Rails

Combination of AND and OR clauses
The same issue happened to me before. I coulnt figure out with $this->db function. And i modify system/database/DB_active_rec.php _compile_select() function Original: Line 1746 if (count($this->ar_like) > 0) { if (count($this->ar_where) > 0) { $sql .= " AND "; } $sql .= implode(" ", $this->ar_like); } My changes: if (count($this->ar_like) > 0) { if (count($this->ar_where) > 0) { $sql .= " AND ("; // open parenthesis for where and like command } $sql .= implode(" ", $this->ar_like); if (count($this->ar_where) > 0) { $sql .= " )"; // close parenthesis and sample sql text > WHERE column = x AND (LIKE QUERIES) } }

Categories : PHP

Combining SQL SUM clauses
You can use a CASE statement for this. You can also move the calculation into the subquery: Select sum(case when rad < 79.85 then value else 0 end) 1stQuerySum, sum(case when rad < 48.57 then value else 0 end) 2ndQuerySum From ( Select lat, lng, value, acos(0.627895140732*sin(radians(lat)) + 0.778297945677*cos(radians(lat))*cos(radians(lng)-(-1.34454929586))) * 6371 rad From `pop_geo_199` Where ( (lat Between 38.1768916977 And 39.6131083023) And (lng Between -77.9596650363 And -76.1143349637) ) ) As FirstCut

Categories : Mysql

Multiple 'IN' clauses
Try joining the subqueries like below SELECT b.* FROM serie b inner join L a on (a.serie_id = b.serie_id) inner join clusterserie c on (c.serie_id = b.serie_id) WHERE c.cluster_id LIKE 'RF%' AND a.L_value = 33 AND a.I_value >= 0

Categories : Mysql

How to/Can we hide share target apps(e.g OneNote, Twitter, etc.) that are displayed after tapping share from charms bar using c# in win 8/winrt apps?
Yes, it is possible to do what you want to. Here is the link for the same. The procedure is The Share charm automatically lists all of the apps installed on your PC that can share. But if you don't want certain apps to appear, you can remove them from the list without uninstalling them.To remove an app from the app list :- Swipe in from the right edge of the screen, tap Settings, and then tap Change PC settings. (If you're using a mouse, point to the upper-right corner of the screen, move the mouse pointer down, click Settings, and then click Change PC settings.) Then tap or click Share. Under Use these apps to share, find the app you don't want to appear, then set the slider to Off to remove it.

Categories : C#

Share links with my app using "Share via" in Android
I have set an Intent Filter on an activity so that my app displays in the "Share via" dialog. That part works fine, but I'm not sure how to actually get the data into my "new post" dialog when it launches. If by "the data", you mean the text that was shared, call getIntent() on your activity and read the EXTRA_TEXT extra for that. In the case of browsers sharing URLs, EXTRA_TEXT should be the URL.

Categories : Android

what does it mean "(include_path='.:/usr/share/pear:/usr/share/php')"?
Thats just the directories showing you where PHP was looking for your file. Make sure that cron1.php exists where you think it does. And make sure you know where dirname(__FILE__) and $_SERVER['DOCUMENT_ROOT'] are pointing where you'd expect. This value can be adjusted in your php.ini file.

Categories : PHP

Multiple OR Clauses in sql server
The DATEPART function gives you an integer that represents the date part of your column without the time-of-day part. Maybe you could compare on that. http://msdn.microsoft.com/en-us/library/ms186724.aspx#GetDateandTimeParts

Categories : SQL

How to get the records according to the where clauses in Mysql?
DECLARE _Str VARCHAR(500); SET _Str=CONCAT("SELECT user_questions.* FROM user_questions WHERE (question_sequence_number IN ("11,13,16,19") OR id IN ("198,199,200,201,202")") PREPARE stmt FROM @s; EXECUTE stmt; DEALLOCATE PREPARE stmt;

Categories : Mysql

SQL partially works but needs a few WHERE clauses - I think
You can't have two else clauses in an IF. And you can't do the UPDATE in two separate queries, because the second one will simply undo the first one. Use the following query: UPDATE tbl_favourites SET favourite_active = NOT favourite_active WHERE user_id = '$who' and `favourite_id = '$usernum' I'm also not sure that the first part, which you say works, really works. Your SELECT query looks specifically for favourite_active = 1. If the user already exists with favourite_active = 0, you'll try to INSERT them. Is that really what you want? Maybe you should remove AND favourite_active = '1'. If user_id and favourite_id form a unique index on the table, you can do the entire thing in a single query: INSERT INTO tbl_favourites (user_id, favourite_id, favourite_active) VALUES ('$who', '$user

Categories : Mysql

MySQL and Advanced Where Clauses
Since the MPG classes are mutually exclusive, the only way to combine them in a query is via an OR clause (since cars can only be in one or another). So, you need to use something like (a.mpgcombined < 18) OR (a.mpgcombined >= 18 AND a.mpgcombined <= 23) i.e. put your class defining sub-clauses in parentheses and then combine them with an OR operator You may need to put the whole resultant sub-clause in parentheses as well, if you're combining it with others, so that the OR clauses don't alter the meaning of your whole WHERE clause.

Categories : Mysql

SQLite Query with two where clauses
You can use ALTER TABLE function on your onUpgrade() method. @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { // If you need to add a column if (newVersion > oldVersion) { db.execSQL("ALTER TABLE foo ADD COLUMN new_column INTEGER DEFAULT 0"); } }

Categories : Android

ON DUPLICATE KEY update (with multiple where clauses)
You should have specified a UNIQUE constraint on compound column for INSERT...ON DUPLICATE KEY UPDATE to work. ALTER TABLE records ADD CONSTRAINT tb_uq UNIQUE (p_id, c_id) and WHERE clause is not needed. INSERT into records (name, value, p_id, c_id) VALUES ('Store', 'TX', 1188913, 1133) ON DUPLICATE KEY UPDATE value = 'TX'

Categories : Mysql

Too many boolean clauses exception in solr
Solr imposes a maxBooleanClause precisely because this is the kind of thing that is outside of its sweet spot. Ultimately, if you need millions of searches, then you will need to do your own distribution and aggregation outside of Solr. I am going to go out on a limb and guess that these clauses are graph related, which is the most common place I see these kinds of queries. In that case, it may be possible for you to stay somewhat inside Solr's strengths here. Sometimes it makes sense to invert the logic of your filter, and instead of passing in a large set of values to filter by, index those values onto the documents you are searching so you can pass a single value later. For example, say you have an index of people. And say you want to search for people who are friends with some speci

Categories : Solr

Refactoring similar subqueries with different WHERE clauses
If the main differences between the columns is tab2.value2, then you could write a query consisting of two stages: Inner query for select the relevant data and grouping it by tab2.value2 Outer query for assigning the result to columns So for the first half of your query it could look like this: select sum(case when val = 10 then cnt end) as RESULT1, sum(case when val = 10 then sm end) as RESULT1_SUM, sum(case when val = 15 then cnt end) as RESULT2, sum(case when val = 15 then sm end) as RESULT2_SUM, ... from ( select tab2.value2 as val, count(*) as cnt, sum(tab3.value5) as sm from tab1, tab2, tab3 where tab1.value1 is not null and tab2.tab3id = tab3.id and tab3.value4 in (1,2,3) and tab3.value3 = 15 group by tab2.value2 )

Categories : SQL

How does PostgreSQL handle multiple WHERE clauses?
Just prepend your query with EXPLAIN and you will see nice information about what planner is really planning. http://www.postgresql.org/docs/9.2/static/sql-explain.html

Categories : SQL

Linq to Datatable with multiple where clauses
Use method syntax instead. It allows you to build query step-by-step: var query = ds.Tables["tblOriginal"].AsEnumerable(); int year; if (Int32.TryParse(cmbFilterYear.Text, out year)) // condition for adding filter query = query.Where(r => r.Field<DateTime>("Datum").Year == year); // repear for other conditions ds.Tables["tblFilteredData"].Merge(query.CopyToDataTable()); // execute query

Categories : C#

Building WHERE clauses from multiple $_GET's
If you're just worried about having a where clause that starts with AND you can add 1=1 to account for no filters. WHERE 1=1 Then, if you have any filters, it will look like this: WHERE 1=1 AND col1=? AND col2=?

Categories : PHP

Python if statement with multiple clauses
Nothing wrong with your approach for a small number of "break values". For a large number of "break values" you are better off to create a table with the break values and the corresponding action. i.e., in your case, a table with wavelength and classification. First row containing 10e-1 and "Radio Waves", 2nd row containing 10e-3 and "Microwaves" In code, you just loop though the until until you find the correct row for waveValue. This is common in Tax Tables. As a bonus, you can store your tax tables in an external database instead of hard-coding the values in your program.

Categories : Python

Squeryl dynamic join clauses
There is a talk related to a similar question on github and a google group: https://github.com/max-l/Squeryl/pull/168 https://github.com/max-l/Squeryl/pull/144 https://groups.google.com/forum/#!topic/squeryl/BBAXbtRq9v4 If you're using squeryl-0.9.5-6, then you should find a way out by your own. I chose to do (a similar task) the following way: /** thin wrappwer with no runtime cost */ implicit class RichLogicalBoolean(val e: LogicalBoolean) extends AnyVal { def and(condition: Boolean, other: LogicalBoolean) = if (condition) other and e else e } after this, I can write a code like: t1.secondary === t2.id and (yourCondition, t1.fallback.isNotNull)

Categories : SQL

Verbose exception catch clauses
When catch exceptions I usually find that more specific is better, that being said typing out all of those different blocks that do the same thing can get really annoying. Thankfully in the Java 7 release a try-catch notation was added where you can specific multiple exceptions for a single block: try{ //some statements } catch (KeyStoreException | CertificateException | NoSuchAlgorithmException | FileNotFoundException | IOException | UnrecoverableKeyException | NoPropertyFoundException e) { LOGGER.error(e); } This sounds like what you are looking for, but there is more detailed information in the Oracle docs: http://docs.oracle.com/javase/7/docs/technotes/guides/language/catch-multiple.htm

Categories : Java

Can or should I join two Where clauses together in a LINQ Query?
Using only one Where clause containing every condition: .Where(a => a.SubjectId == subjectId && a.ContentTypeId == contentTypId) Or two Where clauses, dealing with one condition each: .Where(a => a.SubjectId == subjectId) .Where(a => a.ContentTypeId == contentTypId) is equivalent, as the LINQ query execution is deferred until the call to the result.

Categories : C#

Lambda Expression if-else statement in where clauses
I would prefer extension method syntax in this situation and do it like so: IQueryable<User> query = entities.Users; switch (userField) { case "ID": int searchID; if (int.TryParse(searchText, out searchID)) query = query.Where(u => u.ID == searchID); else query = query.Where(u => false); break; case "Name": query = query.Where(u => u.Name == searchText); break; case "Email": query = query.Where(u => u.Email == searchText); break; } var users = new { total = 10, page = page, record = (entities.Users.Count()), rows = (from user in query select new // etc. ) };

Categories : C#

Multiple where clauses in select and insert
To insert into one table from another table use this syntax: INSERT [LOW_PRIORITY | HIGH_PRIORITY] [IGNORE] [INTO] tbl_name [(col_name,...)] SELECT ... [ ON DUPLICATE KEY UPDATE col_name=expr, ... ] So in your case your query should be: INSERT INTO Orders (CustomerID, CustomerID2) SELECT UID, UID FROM Customers WHERE CustomerName = 'sven'; If you want to insert multiple record from a single query you can use IN operator instead of = like this: INSERT INTO Orders (CustomerID, CustomerID2) SELECT UID, UID FROM Customers WHERE CustomerName IN ('sven', 'smith'); There is a mistake in your join in the SELECT query: You joined both tables with UID while there is no UID in Orders table. May be you mean CustomerID. Try this one: SELECT * FROM Orders a JOIN Customers b

Categories : Mysql

SQL Server Query with Multiple Where Clauses
You do not have a condition here: WHERE (Datediff(dd,TimeStampUTC,dateadd(dd,-1,getdate()))) You need to add an = or <= or >= or < or > or between or something that will provide true or false This seems ok: AND (MeterTagId Between 416 AND 462) Please also post your errors.

Categories : SQL

Django ORM - Grouped aggregates with different select clauses
This is the kind of queries that are easy to explain but hard to write. If this be SQL I will suggest to you a CTE filtered query with row rank over partition by language ordered by date ( desc ) But this is not SQL, this is django query api. Easy way is to do a query for each language: languages = Meetup.objects.values("language", flat = True).distinct.order_by() last_by_language = [ Meetup .objects .filter( language = l ) .latest( 'date' ) for l in languages ] This crash if some language don't has meetings. The other approach is to get all max data for each language: last_dates = ( Meetup .objects .values("language") .annotate(ldate=models.M

Categories : Mysql

Edit query clauses before exec (SQL Sollution)
Actually no direct answer to your question, but maybe it helps anyway. You can create a view, which is like a virtual table. For example if you have the tables product(id, attr1) subproduct(id, subattr1, subattr2) You can create a view like CREATE VIEW legacy_products AS SELECT p.id, p.attr, s.subattr FROM products p LEFT JOIN subproducts s ON p.id = s.id If you define the view carefully, you can avoid changes to your long list of API calls. But only if they consist only of SELECT queries. It is possible to make a view updatable but this is in general not true for a view over two or more base tables (like in the example). SQLFiddle for playing around with: http://sqlfiddle.com/#!2/85676/1 See this for view definition: http://dev.mysql.com/doc/refman/5.1/en/create-view.html

Categories : Mysql

mysql select with the same column appearing twice with different where clauses
This is one solution for a pivot query: SELECT user_id, MAX(IF(district='north', start, null)) AS no_st, MAX(IF(district='north', end, null)) AS no_en, MAX(IF(district='south', start, null)) AS so_st, MAX(IF(district='south', end, null)) AS so_en FROM `NoOneEverNamesTheirTableInSQLQuestions` GROUP BY user_id;

Categories : Mysql

Entity Framework slow with optional where clauses
how long it takes when you execute the query from the sql side? you can use this idea mentioned by scott here on this link Dynamic Linq and i think this will work with you also with Entity Framework, and there is another idea that you can use the entity framework metadata hope that this will help you regards

Categories : Performance

Optimize SQL statement with multiple CONCAT clauses?
OR is a logical operator. It does not define alternatives for LIKE. You need to split that out into two LIKE clauses. SELECT * FROM pages INNER JOIN cms_collection ON (cms_collection.collection_id LIKE CONCAT('%', pages.page_id, '/heading%')) OR (cms_collection.collection_id LIKE CONCAT('%', pages.page_id, '/content%')) WHERE site_id = 51 LIMIT 10 If that is still slow, add your table structure and the output of an EXPLAIN to your question.

Categories : Mysql

How to best use SQL to find common IDs that match multiple WHERE clauses
How about self join? SELECT T1.ID FROM PropertyTable T1 JOIN PropertyTable T2 ON T1.ID = T2.ID WHERE T1.PropertyName = 'Color' AND T1.PropertyValue = 'Blue' AND T2.PropertyName = 'Size' AND T2.PropertyValue = 'Large' Here is an SQLFiddle

Categories : SQL

Hide the share action icon near the share action provider WITHOUT ActionBarSherlock
but none of them clearly say how to edit the Android sources to have another "version" of the ActionBar that hides the icon. That is because you do not change the action bar. You change the ShareActionProvider. If you do not like the existing implementation of ShareActionProvider, create your own, perhaps using the existing implementation as a starting point. For example, that is what the accepted answer on the Android: ShareActionProvider with no history question describes. Neither the question nor the answer reference ActionBarSherlock.

Categories : Android

how to get my facebook share dialog to display the facebook share button rather than just text?
What you are looking for is the Share Button. Facebook has deprecated this and this will no longer be supported. So, you have to use the Share Dialog instead that you've mentioned.

Categories : Facebook



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.