query

SQL (mysql) - If a given row on a given column as a certain value, don't list that column.

I have a query that retrieves some data, among those data I have some that are returned with a value like 0. I would like the query to NOT return the columns when that's the case. How can we do such a thing? Regards, MEM ...

MySQL: Return fields where COUNT(*) is greater than ...

I've got the following SQL, but I only want to return rows where 'hits' are greater than 10. SELECT clicks.affiliate, COUNT(*) AS hits, affiliates.title, affiliates.url FROM clicks INNER JOIN affiliates ON affiliates.id = clicks.affiliate GROUP BY clicks.affiliate Thanks. ...

query not working with empty fields on access

What is wrong in this query running on MS Access 2003 database. It works fine if fields are not empty, but when any of the fields is empty it results empty string. SELECT CustomerName,IIF(Address1="","",Address1)+IIF(Address1& Address2="","",",")+IIF(Address2="","",Address2)+IIF(Address1&Address2& Address3="","",",")+IIF(Address3=" ","...

T-Sql group/sum query question

It's been a crappy Monday AM and I can't think straight. Can someone help me figure out how to group/sum the rows returned so that there is only ONE instance of the AssessorParcelNumber? So, instead of the following result set: 140-31-715-164 3545 2004-09-14 00:00:00.000 1665.00 0.00 0.00 1665.00 140-31-715-164 3545 2004...

How to run SQL Queries on EF ?

I am working on EF with C# and WPF as front end. I need to provide a UI for so user can create his own query and get the result. The UI will be list of tables and list of columns to select from (Not happy with UI. Need to improve but new ticks in my mind). So my question is how create, merge(existing query) and execute the queries. The...

SQL query logic for selecting a unique subset of records from a many to many table.

I've run into quite a tough problem for my novice SQL query writing skills. I'll try and describe my problem as best I can. Table1: Account, Date, Time, Area, ResultValue, ResultString, Phone, GUID Table2: Name, Account, phone, GUID For each record in Table2 I need the the single record from Table1 that is most accurate to the follow...

Lucene.Net and Nhibernate.Search: how to manage complex searches?

We have a SQL Server database with a million-ish records that are indexed by Lucene.net through Nhibernate.Search. When we built the index for our classes, we tried to be extensive since the cost for indexing/retrieval was really small. The goal was to offer full-text searching to users on a webpage with pagination. Since SQL Server com...

Complex mysql query, please help.

I have a table of banners. Banners are marked with size id and slot id(position on page) I need to pick 8 banners of one size, 1 for each slot between 11-18(slot id) and keep randomness each page view, so that each time banners were different if there any different for required slot. The only solution i have found is this: SELECT * FR...

Change varchar data type to Number in Oracle

I have data like this in oracle database -> 20123,45 ,data type is varchar. and I want to migrate it to column with NUMBER data type, change comma (,) to dot (.). so expected result is 20123.45 and data type is NUMBER, how can I do that ? thanks before :D ...

What database table to alter to have a bestseller product in webshop?

Hello, I do have a little expierence with database tables, but I can't read a db_query I believe to have a query which should enable a product as a bestseller and place it in scroller. I want to fake a bestseller because it looks a little dump when opening a webshop with having a empty bestseller list. I have manually altered the table...

data not transfering from Textbox to query

Hi there... I am creating a desktop application in C# where my code is : private void btnLogin_Click(object sender, EventArgs e) { if (clsFunctions.recordExist("SELECT AtNumConstructorID, TxtConstructorName AS Fullname FROM tblConstructorDetails WHERE txtUserName = '" + txtUserName.Text + "' AND TxtPassword LIKE '" ...

Different results fetching results with query api vs. hql

I have the following entity (not exact but gives a general idea): @Entity public class WebElement implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue private Long id; @ManyToMany(fetch = FetchType.EAGER, cascade = { CascadeType.ALL }) private Set<CoreElement> coreElements; ...

Sending queries to google using python

Hi, I need a code with which I can send queries to Google and get the results back for some processing. i am mostly interested in retrieving the snippets of the results. It would be nice if I can do this without installing any extra packages for Python. A pre-written api would also do the trick. Thanks ...

postgresql union

I have this data in postgresql id | rate | hrv | activity | orientation | timestamp | user_id | status ----------+-----------+-----+----------+-------------+------------------------+---------+-------------- 66764728 | 72 | 1 | 0 | 90 | 2010-06-10 18:54:54+00 | 397 | t 66764729 | ...

dataset to linq editor (visually create linq query - like vlinq)

Hello, I am interested in creating a visual linq editor (like provided in sql server management studio). which i want to use in my application to give end user the ability to create linq queries on dataset. I tried to understand VLINQ, but i am unable to understand, how can i use it as a starting point. Can someone please guide me or poi...

Is their a posIndex in MS Access Queries?

Hi, I need to write a query like SELECT substring(variable, startPosIndex, endPos) from Blah blah ; startPostIndex = indexPosition('#') endPos = lenght(variable) - 1; So basically my query to access will be SELECT substring(variable, indexPosition('#'), lenght(variable) - 1) from Blah blah ; The query that I have written to get if...

Delete all record exist in all table.

Hello there, How to make query in sql to delete all record exist in every table. There possible to write every name table using command delete. But it will take long time to write every single name table. I am already try DELETE FROM * in MySQL but it got error: You have an error in your SQL syntax; check the manual that correspond...

Need a query to move all the emails from one table into another using a common row value as the link

An import was performed on my database which wasn't done so well. It's resulted in some fields being empty where they shoudln't, etc... What I need to do now is move all the data from one column in one table into a column in a different table. Both tables have an ID which is a link to each rows. For example: Table1 id | linkID | emai...

How to duplicate row in SQL Query result....

SELECT * FROM TABLE1 ID Name 1 SOF 2 USER I want query which can one or two or four .... times ID = 1 in row like What will be the Query of this in Ms.Access? ID Name 1 SOF 1 SOF 1 SOF 2 USER ...

Rails 3 Query Interface: using associated models

I'll use the generic blog example. class Post < ActiveRecord::Base has_many :comments end class Comment < ActiveRecord::Base belongs_to :post end When querying Post, how do you access its associations (i.e. :comments)? This should be the easiest thing in the world, but I haven't found any documentation on it. Even http://edgeguid...