query

Where clause in where - version 2 :-)

i need to do this : There is a table called table1 it has a employee id column,status column which has values 1 and 0 only and a department column with values 100,101,102. i want to list all employeeid with the status = 0 from the above list i want to filter the employees which having (department=100 and whose status=1) Extended que...

SQL query to retrieve from three inter related tables

I have three tables specifying important columns below Users(Id, username) Groups(Id, groupname, creator) (creator is the creator of the group) Association(Id, UserId, GroupId) (entries in this table include which user is in which group) Association.UserID =Users.Id, Association.GroupId = Groups.id and also Groups.creator = Users.Id....

SQL-Query needed to find distinct IDs probably using IN and NOT IN

Let's pretend I have a large recipe-database. A table for recipes each with an unique ID and a table for ingredients with a whole lot of sets like this: ID | RECIPE | INGREDIENT ------------------------------- 1 | recipe_a | ingredient_a 2 | recipe_a | ingredient_b 3 | recipe_a | ingredient_c 4 | recipe_b | ingredient_a ...

write a Query List Comprehensions for a mnesia query

I'm trying to build a small testing app with erlang+mnesia. I have a user table build from the #user record, as defined here: -record(user_details, {name, password}). -record(user, {id, details}). then I insert a user with that function: add_sample_data() -> Mat = #user{ details = #user_details{ name = "mat", password ...

Core data select objects from an array - iPhone

Hi everyone, I was wondering if I could select objects based on a predicate with an array... for example Code: [NSPredicate predicateWithFormat:@"id=%@", arrayOfID]; Will it work? If no, how can I do it? Best ...

SELECT a list of elements and 5 tags for each one

Hi, I'm trying to query a set of buldings listed on a table, these buildings are linked with tags. I'm able to do it, but my problem is how limit the number of tags to see: table buildings id building_name style 1 Pompidou bla 2 Alcatraz bla 3 etc. etc. table tags // they can be 50 or m...

Externalize BIRT queries

Hi, Is there a way to externalize report queries for BIRT reports. We need to support multiple database engines and so our queries are different depending on the underlying database. I would like to use a config parameter to tell BIRT report to use a specific query file ...

Can't change data type on MS Access 2007

Hi All, I have a huge database (800MB) which consists of a field called 'Date Last Modified' at the moment this field is entered as a text data type but need to change it to a Date/Time field to carry out some queries. I have another exact same database but with only 35MB of data inside it and when I change the data type it works fine,...

PHP - get MySQL query results as their native data type?

I've tried fetching MySQL query results using mysql_fetch_row() mysql_result() and numeric values are being returned as strings. Is there any way to fetch the data as its datatype stored in the table? The application will be querying many different queries so I will be unable to cast the values as the intended datatype on a 1 by 1 basi...

optional search parameters in sql query and rows with null values

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...

MS-Access: SQL for updating a column in a table

Hi, I have the following table in an access database id VisitNo Weight 1 1 100 1 2 95 1 3 96 1 4 94 1 5 93 Now row 2 and 4 are deleted. So i have... id VisitNo Weight 1 1 100 1 3 96 1 5 93 However what i need is......

selecting number of rows from resultset

Suppose a query "select * from employee" returns 80 rows. I need to display middle rows that is from 20th row to 50th row. I know, like to display first 20 rows we have option like "select top 20 * from employee" but if we need middle rows how to get it in MS SQL specifically. I m new to this SQL queries...Can anybody answer to this qu...

Display part of entry

Suppose a query "select streetAdr from Address" returns "236 a1 road" "333 a2 road" and 444 a4 road" as 3 rows. How i can display only "236" "333" and "444" in SQL Server. ...

SQl to select from multiple tables

I have two table emptable1(empid,status) emptable2(empid,week) i want to select all the empid whose status is 0 in emptable1 and from that list of empid i need to select empid whose week is 7 from the table emptable2 Please help :-) ...

MySql query BETWEEN two Strings sometimes doesn't work

I have a mysql query where a subquery is: BETWEEN '5.00' AND '10.00' And this returns no results. However when I use Floats or Ints: BETWEEN 5 and 10 it works The BETWEEN query also works for other values AS strings, but just not for 5 and 10. EG: BETWEEN '4' AND '5' works. How could this be? ...

Erlang ODBC parameter query with null parameters

Is it possible to pass null values to parameter queries? For example Sql = "insert into TableX values (?,?)". Params = [{sql_integer, [Val1]}, {sql_float, [Val2]}]. % Val2 may be a float, or it may be the atom, undefined odbc:param_query(OdbcRef, Sql, Params). Now, of course odbc:param_query/3 is going to complain if Val2 is undefi...

Recursively MySQL Query

How can I implement recursive MySQL Queries. I am trying to look for it but resources are not very helpful. Trying to implement similar logic. public function initiateInserts() { //Open Large CSV File(min 100K rows) for parsing. $this->fin = fopen($file,'r') or die('Cannot open file'); //Parsing Large CSV file to get dat...

How to run a progress-bar through an insert query?

I have this insert query: try { Cmd.CommandText = @"INSERT INTO BarcodTbl SELECT * FROM [Text;DATABASE=" + PathI + @"\].[Tmp.txt];"; Cmd.ExecuteNonQuery(); Cmd.Dispose(); } catch (Exception ex) { MessageBox.Show(ex.Message); } I have two questions: How can I run a progress-bar from the beginning to the end of the insert? I...

MySQL Rating system (calculating average from two tables).

I have two tables, videos and videos_ratings. The videos table has an int videoid field (and many others but those fields are not important I think) and many records. The videos_ratings table has 3 int fields: videoid, rating, rated_by which has many records (multiple records for each fields from the videos table) but not for all records...

Simple PHP Array Problem - IF EXIT

Hi, how can i convert this into an array? if someone searches for "lo" he gets the text "no query", but how can i do this for more words? i tried it with array('1','2').. if ($query == 'lo') { exit ('No Query.'); } i want something like this if ($query == 'lo', 'mip', 'get') { exit ('No Query.'); } so, if someone types mip he g...