query

sql insert and update question..multiple queries in one statement

I have a table called auctions, which has various columns such as username, auction id(the primary key), firstname, lastname, location etc, as well as a category column. The category column is blank by default, unless it is filled in for a particular record by a user. I have made a new users table, which has username and category colum...

mysql prepared statement parameters and ordering queries

I have a form, the purpose of which is to place the currently displayed record into a category. I am using the following html code via php to do so: <form name="categoryForm"> <input name="radiobutton" type="radio" value="fakeapproved" />Fake (Approved)<p> <input name="radiobutton" type="radio" value="fakesuspected" />Fake (Suspecte...

Using function from form in Access SQL statement?

Hello, I know if I make a code module in Access and place a function in it, I can run a query that has embedded calls to that function. However, I want to know if I can get a function that belongs to the code part of a form to be recognized by Access in a query. So far I cannot find a way, but it seems to me that this should be possible...

Refer to other SQL SELECT statements aliased as tables in FROM clause

I have a very large query that follows the format below: select ... from ( select field1, field2 from some_table ) table1, ( select field1, field3 from other_table ) table2 where ..... Is is possible for me to refer to one of the tables "defined" in the from clause, lets...

How should I best query my dataset from VB.net?

I have a VB.Net data set that contains data from multiple tables. Does anyone have any good suggestions on how to query data out of the dataset. I want to run SQL-like queries on a dataset to extract data that fits a certain "where" statement. ...

SELECT * FROM in MySQLi

My site is rather extensive, and I just recently made the switch to PHP5 (call me a late bloomer). All of my MySQL query's before were built as such: "SELECT * FROM tablename WHERE field1 = 'value' && field2 = 'value2'"; This made it very easy, simple and friendly. I am now trying to make the switch to mysqli for obvious security re...

multidimensional PHP array or multiple queries to mysql DB

Hi there I'm using the PHPExcel lib which it seems to do great jobs, but in my approach it doesn't seem to be so fast. I need to generate a excel file with allot of sheets, data, formulas and styles(bold, color, border) and it takes me allot of computing resources and time. I think that my approach is not so good. Which has to be the ri...

querying ldap to retrieve groups user is member of (in sharepoint)

I'm using Sharepoint in combination with Nintex. The possibility to query the ldap is available via Nintex, and basic querying actions work well! Now I am trying to get an array or collection of the groups the user is member of.. i've tried (&(objectCategory=group)(member=cn={itemproperty:ldapName},dc=MyDomain)) Unfortunately this doe...

SQL Help in Access – Looking for the Absence of Data

I am trying to find the fastest way to find all of the records in a parent table that do not have certain records in a child table. For example, I want the query to return all of the family records where there are no male children or no children at all. Example 1 This is painfully slow: SELECT * FROM Families WHERE Families.FamilyID ...

PHP Query Fail

<?php if(isset($_POST['upload']) && $_FILES['userfile']['size'] > 0) { $dbhost = 'localhost'; $dbuser = 'zuk1_boo'; $dbpass = 'lols'; $dbname = 'zuk1_boo'; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); $name = $_POST['name']; $iq = $_POST['iq']; $nuname = str_replace(" ", "-", $name); $nuname =...

sql - updating without overriding existing information

I have the following conditional code, which will insert a new record if a record with the appropriate username does not exist, and update the record if it does exist. This works fine. However, at the moment, if I insert a new record, and only insert the firstname and lastname, and maybe address details with say phone information being ...

Simple Query to Grab Max Value for each ID

OK I have a table like this: ID Signal Station OwnerID 111 -120 Home 1 111 -130 Car 1 111 -135 Work 2 222 -98 Home 2 222 -95 Work 1 222 -103 Work 2 This is all for the same day. I just need the Query to return the max signal for each...

Retrieving a current and most recent previous value (Oracle)

Hi all, I'm facing a problem which I've spent a great deal of time trying to address, and although I have a solution, it's clunky and involves pl/sql processing, and I was wondering what others might come up with. I'm working with a dataset that creates a new row every time a record is changed, thus maintaining a history. The most up-to...

Storing multiple employee IDs in one column of data

Web app is being written in classic ASP with a MSSQL backend. On this particular page, the admin can select 1 or any/all of the employees to assign the project to. I'm trying to figure out a simple way to store the employee IDs of the people assigned to it in one column. The list of employees is generated from another table and can be d...

Where do you store long/complete queries used in code?

Here's my situation. I've noticed that code gets harder to maintain when you keep embedding queries in every function that will use them. Some queries tend to grow very fast and tend to lose readability after concatenating every line. Another issue that comes with all of the concatenation is when you must test a specific query and paste ...

TOP N problem with GROUP BY clause

The problem: I need to find all active [GiftPledges] that have the last three [GiftDetails] have a zero amount. SELECT gp.PledgeId FROM GiftPledge gp INNER JOIN GiftDetail gd ON gp.PledgeId = gd.PledgeId WHERE gp.PledgeStatus = 'A' GROUP BY PledgeId HAVING COUNT(PledgeId) >= 3 Now, I have all my [GiftPledges] t...

Where do you put your SQL Queries?

We are using a mix of EJB 2.1 and JDBC to access our Database. I just had a co-worker mention the idea to put his SQL Queries into a .properties file. How and Where do you put your SQL Queries? EDIT: Do you inline it with the code, put into the class instantiation? ...

Standard SQL Query much faster than Linq 2 SQL

Hey there I got a problem with my code, I compared three ways of implementing a query on a database Standard SQL Query (From * Select ...) LinQ Query Precompiled LinqQuery (CompiledQuery) Now the result I got is that the Precompiled LingQuery is 5 times faster than the LinQ Query but much more interesting ist that the Standard SQL Q...

Are MySQL Triggers Asynchronous

When an AFTER UPDATE or AFTER INSERT trigger is fired is it a synchronous or asynchronous event? In other words does it hold up the total execution time of the query that tripped the trigger? ...

Count Query in SQL

Hi. I am using SQL 2005. Table one, LinkedDocumentFolderTable, contains the names and information about the folders that hold linked documents. Table two, LinkedDocumentTable, contains the information about the linked documents themselves. The two tables are linked by the LinkedDocumentFolderID. I need the LinkedDocumentFolderID, De...