I have two fields (project and version) from two different tables, and I am trying to get the total of entries that match unique project/version combinations, however the versions in some projects match up with versions in other projects (Project 1 has version 1.0, and so does Project 2) so my SQL statement isn't working:
SELECT TOP 100...
For some reason I'm having a problem retrieving data from my database. It leaves off the first item being listed.
Connection:
mysql_select_db($database_my_db, $my_db);
$query_rs_jobboards11 = "SELECT * FROM jobBoardsSpecTypes ORDER BY type";
$rs_jobboards11 = mysql_query($query_rs_jobboards11, $my_db) or die(mysql_error());...
Hi folks,
So i'm having this problem.
I have two tables (Oracle), one is called Destination and the other one Reserve. Reserve has a foreign key to the id of Destination (Because on reserve has one destination). And reserve tuples means all the reserves that all the users have done. I need a way to check the top 3 most visited Destinat...
I have a table (participants) which has multiple columns that could all be distinct.
Two columns that are of special interest in this query are the userID and the programID
I have a two part inquery here.
I want to be able to acquire the list of all userIDs that appear more than once in this table. How do I go about doing it?
I want t...
When designing a database, what usually determines what tables will be the primary and foreign table in a relationship?
For example, if I have a table called posts and it contains and id column postid and I have a table called comments and it contains a column called postid. Which of these tables would be the primary one in the relati...
Hey, I have a table with "id", "name", and "weight" columns. Weight is an unsigned small int.
I have a page that displays items ordered by "weight ASC". It'll use drag-n-drop, and once the order is changed, will pass out a comma-separated string of ids (in the new order).
Let's say there's 10 items in that table. Here's what I have so ...
I have a table that stores data from the county appraisal district. I want to add a computed column to tell me if the property is owner-occupied. I define "owner occupied" as true if the property address is the same as the owner address, false otherwise.
Because of data entry inaccuracies in the source data from the county, if I do a st...
I have one table in which I need to do some simple math on a field. I have attempted nested SELECTS, IF/THEN, or CASE staments within SQL to no avail.
EXAMPLE TABLE:
wYear, yMonth, Account, Usage, Serv_code
2008, 9, 12345, 1000, Banana
2008, 9, 12345, 5000, Banana
2008, 9, 12345, 4000, Apple
2007, 5, 54321, 1500, Banana
I need to Grou...
I heard that SQL Injection can still be possible when using ADO.NET SQLParameter (paramterised query) for SQL Server.
I am looking for real examples in C#/VB code as proof.
EDIT:
I am looking for SPECIFIC working examples. Not introductions to sql injection or how to prevent it.
...
I have access to command line isql and I like to get Meta-Data of all the tables of a given database, possibly in a formatted file. How I can achieve that?
Thanks.
...
I have a table programparticipants, I am currently successfully querying the IDs where count(name) > 1. What I need now is to query the names that belong to those IDs where count(name) > 1. Can anyone help me please?
Example, data result currently being returned:
ID count(name)
1 2
3 4
4 ...
I'm not sure if this is going to be possible in a single query, but I'm trying to achieve the following with MySQL and haven't yet found a solution.
I have a table that is structured a little like this:
ID LOG_VALUE LOG_TIME
1 5000 19:05:42
2 6205 19:05:45
3 1000 19:05:40
1 ...
Hi, I have a query that strips data from a XML string, inserts it into a table variable and queries it to insert the data into another table. It runs like a charm in my localhost environment, but not in my production SQL Server database. The error message is "INSERT failed because the following SET options have incorrect settings: 'ARITH...
I and my friend argued with each other about the design of a database.
He argues that to ensure the integrity of a complex database is better to use triggers.
I believe that for this purpose is better to use keys (primary, unique), and constraints.
I think that the use of triggers is dangerous, because they work "behind the scene" and...
The following query (V_TITRATION_RESULTS) is a view uses a row-to-column pivot which returns about 20,000 rows:
SELECT test.created_on as "Created On",
r_titr as "Titrator",
r_fact as "Factor"
FROM (SELECT test_id,
MAX(CASE WHEN result_tmpl_id = 2484 THEN result END) r_titr,
MAX(CASE WH...
I'm looking to build a scalable database solution for the back end of my website. I've been reading about database design lately, and I seem to have developed an idea on my own that might work. I think this is a novel way of maintaining n databases with synchronized data, but I could be wrong. So I'm asking SO to evaluate the idea and te...
I have two tables I need to select data from TABLE_A and TABLE_B; they have a one to many relationship.
In my select statement I will often get multiple unique results from TABLE_A and this is fine. But I will also get multiple matches in TABLE_B - I need to get the most recent TABLE_B record that matches. I have an auto incremented id ...
I'm working with MS Access to do some math. I'm taking a Cost and Dividing it by a decimal value to get a Price. I'm using a link table and a access sql query.
SQL Ex
Select (cost/markup) As Price From T_Cost;
Calulcation Ex.
1234 / .55 = 2243.6363
1000 / .50 = 2000
I'm trying to figure out a way to remove the decimal places that w...
I would like to implement this in Linq to SQL:
select * from (
select * from Orders) as A
Obviously this is a pointless example, but I just can't figure out how to do it!
...
In Microsoft SQL Server, I know the query to check if a default constraint exists for a column and drop a default constraint is:
IF EXISTS(SELECT * FROM sysconstraints
WHERE id=OBJECT_ID('SomeTable')
AND COL_NAME(id,colid)='ColName'
AND OBJECTPROPERTY(constid, 'IsDefaultCnst')=1)
ALTER TABLE SomeTable DROP CONSTRAINT DF_SomeTa...