query

SQL Query Not Functioning - No Error Message

ORIGINAL TEXT REMOVED OK, so I found the original problem thanks to a helpful answer. It lists "Invalid query: No database selected" as the error. require_once ('../dir_connect.php'); $dbc = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); if (!$dbc) { die('Could not connect: ' . mysql_error()...

MYSQL - Selecting a specific date range to get "current" popular screensavers.

Let's say I have a screensaver website. I want to display the CURRENT top 100 screensavers on the front page of the website. What I mean is, "RECENT" top 100 screensavers. What would be an example query to do this? My current one is: SELECT * FROM tbl_screensavers WHERE WEEK(tbl_screensavers.DateAdded) = WEEK('".date("Y-m-d H:i:s",str...

Using the LIMIT statement in a SQLite query

Hi guys. I have a query that selects rows in a ListView without having a limit. But now that i have implemented a SharedPreferences that the user can select how much rows will be displayed in the ListView, my SQLite query doesnt work. Im passing the argument this way: return wDb.query(TABELANOME, new String[] {IDTIT, TAREFATIT, SUMARIO...

Conversion from string to type 'Double' is not valid.

Hi, I am getting the following error while running a select statement (using OleDbCommand). My query is SELECT CME FROM Personnel WHERE CME = '11349D' If objOleDbCom.ExecuteScalar() > 0 Then When i execute the above statement i got this error Conversion from string "11349D" to type 'Double' is not valid. My field CME data t...

How to select a table from highest table use LinQ query

I have a sequence relationship: A has many Bs. B has many Cs. C has many Ds. They also make me so confused if there are more than 3 or 4,..tables. So, how can i select all Cs that satify A.Id="1". (something likes finding all grandsons of a grandfather) Thanks in advance. ...

Querying for names

I have a table (say "Demographics") on SQL Server. In this table are the following columns "LastName", "FirstName", "MiddleName", "Prefix" , "Suffix". I have one textbox to search for them on a webpage. My question: Whats a good design strategy for queries where the user could be searching for various combinations of names including las...

Implement Partial sorted query in sql server 2005

I have to show records in such a way that some selected records should come first. After this, another records come in sorted manner from the same table. For example, If I select state having stateID = 5 then the corresponding record should come first. after this another records should come in sorted manner. For this, I tried union but...

MySQL: Copy a field to another table

I have a table posts that could look like this: id | title | body | created | .. ------------------------------------------- I would like to use the boolean search feature that is offered by a MyISAM Table, but the posts table is InnoDB. So I created another table 'post_contents' that looks like this: post_id | body ----...

Liqn to sql null-able value in query

I need get all items these have no categories int? categoryId = null; var items=db.Items.Where(x=>x.CategoryId==categoryId); this code generate in where: where CategoryId=null instead of where CategoryId is null ok, when i write var items=db.Items.Where(x=>x.CategoryId==null); in my sql profiler it works: where CategoryId i...

alias all column in a query with a prefix

it's possible to alias all column with a prefix, in a select? I have a group of tables in an Oracle db that I need to join together, and most of them have the same column names. I would like to have something like select MAGIC_ADD_PREFIX("PREFIX", *) from TABLE and have a result like +---------+----------+----------+ |PREFIX_ID|PREFI...

Need Help With Hibernate/SQL Query Count Logic

I have the following query: SELECT DISTINCT w.name, count(*) FROM widgets AS w JOIN w.entity AS e JOIN e.article AS a JOIN a.document AS d WHERE d.id IN (<document ids>) GROUP BY w.name The problem is that count(*) returns the number of widget-entity associations. Instead, what I'm looking for is the number of unique widget names, per...

select only new row in oracle

Hi, I have table with "varchar2" as primary key. It has about 1 000 000 Transactions per day. My app wakes up every 5 minute to generate text file by querying only new record. It will remember last point and process only new records. Do you have idea how to query with good performance? I am able to add new column if necessary. What ...

MySQL Query exceptions

In one page, it should show records that has the following selected month from the drop down menu and it is set in the ?month=March So the query will do this $sql = "SELECT * FROM schedule WHERE month = '" . Clean($_GET['month']) . "' AND finished='0' ORDER BY date ASC"; But it shows records that has a value of 2 in the finished colu...

Using SQL to get the Last Reply on a Post

I am trying to replicate a forum function by getting the last reply of a post. For clarity, see PHPBB: there are four columns, and the last column is what I like to replicate. I have my tables created as such: discussion_id (primary key) user_id parent_id comment status pubdate I was thinking of creating a Link Table that would u...

ave releted to my project

I want to fetch data from two table buut i m realy confused. just i want recent two users in my site but problem is there that two users releted information stored in other table . I also used join query to fetch that data but proper result not get . ...

Intersecting boundaries with lucene

I'm using Lucene, and I'm trying to find a way to index and retrieve documents that have a ranged property. For example I have: Document 1: Price:[30 TO 50] Document 2: Price:[45 TO 60] Document 3: Price:[60 TO 70] And I would like to search for all the documents whose ranges intersect a specific interval, in the above example, if I ...

formatting the output of a sql query.

Hi! I am using solaris os. from solaris im logging into sql plus. my database is oracle 9i. i am spooling the output of my query into a file. i want in .csv format so that i can copy it into excel. can any1 help me out. my query is like. select name,id,location from employee; ...

In SQL Server what is most efficient way to compare records to other records for duplicates with in a given range of values?

We have an SQL Server that gets daily imports of data files from clients. This data is interrelated and we are always scrubbing it and having to look for suspect duplicate records between these files. Finding and tagging suspect records can get pretty complicated. We use logic that requires some field values to be the same, allows som...

parametrized query jqgrid

Hey, I have this mysql tables I want to display with jqgrid. The problem appears when I want to display a parametrized query. For example lets say I want to display all students older than 21. I have this variable named age which I want to pass to server.php file where I can construct the XML or JSON. On server I see some variables l...

A jscript variable in a Query

Maybe a very simple question. How can I put in this code <Query> <Where> <Eq> <FieldRef Name="Judge_x0020_1" /> <Value Type="Text">mr. R. Sanches</Value> </Eq> </Where> </Query> A variable from jscript in the area of the code where mr. R. Sanches is written. So my jScript contains a dynamic text va...