where

User selects operator from drop-down menu and use it in PHP function

Hi guys, What I would like to achieve here is a user selects an operator, e.g. +, >, <, >= etc. and uses this in a Select statement in PHP. MY HTML code: <label for="grade">Grade: </label> <select name="operator" id="operator"> <option value="">Select one</option> ...

SQL Select Statement with WHERE, AND, OR

Hi guys, I would like to perform a SELECT query with MySQL. My goal is to select all the dogs in a vet database that would be sex=male and fur=short and (color=black or size=big) Note: I want to select dogs that are either black or size are big. They don't have to fulfill the 2 requirements. They just need to fulfill either one. I have...

Query a winforms control with CheckedListBoxItemCollection.AsQueryable().Provider.CreateQuery(...

Hello, I need to query a winforms control(CheckedListBoxControl) having a CheckedListBoxItemCollection which I want to query for a certain Id that is within the property "Value" of the CheckedListBoxItem. CheckedListBoxItemCollection items = myCheckedListBoxControl.Items; foreach(Department dep in departmentList) { bool isDepExisti...

MySQL Query Problem with Alias and Aggregate Functions

I have a troublesome MySQL query as follows: SELECT camera_id, ((avg(low_price) + avg(high_price)) / 2) as avg_price FROM camera_general, camera_products WHERE camera_id = ir_camera_id AND dp_post_dt IS NOT NULL AND dp_post_dt NOT LIKE '0000%' AND currently_manufactured = 'Yes' AND ((no_of_sellers >= 0) OR ((TO_DAYS(CURRENT_DATE) - TO_D...

If condition in LINQ Where clause.................

Can I use if clause with Linq where? ...

Constraining combo box rows to field entry of the same entry

I have three related tables: People has ID fields for both Organisations and Locations. Locations has an ID field for Organisation. I want the Locations combo box in my People table to show only the Locations that have the Organisation_ID that was entered previously. I tried WHERE but it doesn't seem to recognise the [People].[Organisati...

XQuery distinct values with where clause problem

Hi I'm very new to XQuery so excuse me if I am somehow missing something. I am trying to extract data where certain sub-nodes of an element are DISTINCT, as well as where a certain sibling node's is equal to some predefined string for $product in fn:distinct-values(document('cpwdoc')/root/package/properties/value[@key="product"]) wher...

Entity Framework Views and Linq .Where

I have a very small entity framework setup containing only a few related classes/tables and a view. I need to be able to pull a specific record from this view, namely, I need to be able to grab the record that meets two criteria, it has a specific ProfileID and a specific QuoteID. This line is what's causing the problem: TWProfileUpcha...

How to write WHERE IN query in LINQ to Entity?

Possible Duplicate: 'Contains()' workaround using Linq to Entities? Hi every one. I would like to know how to write the "WHERE IN" query in LINQ to Entity. I have tried with the following code: string[] strings = GetRequest("userID").Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); List<long> longs = strings....

MySQL IN with LIKE

How would I use a IN table with like? So that I could use % in them? By in I mean: SELECT fields FROM table WHERE age = "50" AND name IN ("tim", "bob", "nancy", "john"); I already tried: SELECT fields FROM table WHERE age = "50" AND name LIKE ("2010-09-17%", "2010-09-16%") But it gave the error "Operand should...

MySQL SELECT WHERE 'a' IN (`field`)

Hello, I know it is not an appropriate technique to have a structure of MySQL table as such, but I have to work with such. The problem is, that the field in table has value with comma seperated integers, like "1,3,5,7,10" and I want the query to return rows, in which field has a to the query passed number in it, like: SELECT * FROM `tab...

MySQL COUNT in two tables same time.

Hello! My question is not so hard, i just really can't find the answer anywhere. I've got 3 tables. webshops, webshop_category and webshop_item. My query is: SELECT webshops.id, webshops.name, webshops.tax, webshops.contact_name, webshops.contact_email, webshops.contact_phone, webshops.contact_address, COUNT(webshop_category.id), CO...

How do I add a WHERE statement to this :select in rails?

I have the current find statement with :select: @list = Contact.find :all, :select => "companies.name AS co_name, COUNT(contact_emails.id) AS email_count, COUNT(contact_calls.id) AS call_count, COUNT(contact_letters.id) AS letter_count, COUNT(contact_postalcards.id) AS posta...

How to use ObjectQuery with Where filter separated by OR clause

Hi guys, Could somebody help me to answer how to rewrite raw SQL filter WHERE (...) OR (...) with ObjectQuery bilder, please? String queryRaw = "SELECT ls.LocaleName, ls.IsActive, ls.LocaleDescription " + "FROM RoutesEntities.Locales AS ls "; //" WHERE ls.LocaleName = 'en' OR ls.LocaleName = 'de' " ...

How to use Rails 3 scope to filter on habtm join table where the associated records don't exist?

I have an Author model which habtm :feeds. Using Rails 3 want to setup a scope that finds all authors that have no associated feeds. class Author < ActiveRecord::Base has_and_belongs_to_many :feeds scope :without_feed, joins(:feeds).where("authors_feeds.feed_id is null") end ...doesn't seem to work. It feels like a simple t...

mysql insert command with a where clause

im trying to insert data into a particular row in the database, but i mysql is saying this is an error: INSERT INTO user (rep, course) VALUES('5', 'computer science') WHERE user='2' ...

Using DateTimeOffset as WHERE criteria in a SQL Server 2008 query

Hi Everyone, I was wondering if anyone could help me understand why these two criteria do not return the same result sets. To me, it seems weird that SQL Server 2008 R2 wouldn't know to use the offset while constraining the data. Is there a better way to do this? As far as I can tell, Criteria Two is the only way to get the correct data...

nest dynamic case when statements in sql 2008

Hello Experts, I have the following code in .net. foreach (string key in EntityNumbers.Keys) { if (EntityNumbers[key] != null) { e = new WebServices.Entity(); e.HierarchyLevel = key; e.Number = EntityNumbers[key]; ...