Hi SQL experts,
I have one table A that has a column C and a lookup table (lookup) that provides a description given an ID.
Here the setup:
table A with column C values:
1,2,3
2,3,4
table lookup:
1, 'This'
2, 'is'
3, 'tricky'
4, 'SQL'
Provide a SQL (SQL Server 2005) statement that returns the following strings:
Input: 1,2,3 Out...
I can link the results of an existing table/view to an Excel spreadsheet (by choosing the table from the "Select Database and Table" window of the ODBC Wizard, however I'd like to execute a raw query instead.
I would like to generate a query (as a string) based on cell values. Then, the user could manually "refresh" the data table whic...
Can somebody please, let me know that how do we find that full text search is enabled in SQL 2005.
...
Hi, a quick question in regards to table design..
Let's say I am designing a loan application database.
As it is right now, I will have 2 tables..
Applicant (ApplicantID, FirstName , LastName, SSN, Email... )
and
Co-Applicant(CoApplicantID, FirstName, LastName , SSN, Email.., ApplicantID)
Should I consider having just one table beca...
I have a query that uses a where clause. At times, this may be used and at others, I may want to omit it completely to get back all results. I can certainly write two different queries but I would like to cut down on any code that I can for simplistic reasons. Is there a way to do this in mysql?
Take a query like:
SELECT * FROM my_tabl...
This is probably easier than I am making it, but basically what I need to do is select the row that has the closest number in a column as a specified value. For example:
List of values in database for 3 rows in a specified column: 10, 15, 16
If I specify that I want the row that is closest to 14, it would pick the row with 15.
Also, ...
I am building a hit counter. I have an article directory and tracking unique visitors. When a visitor comes i insert the article id and their IP address in the database. First I check to see if the ip exists for the article id, if the ip does not exist I make the insert. This is two queries -- is there a way to make this one query
Also...
This script I'm working on is taking data from the web using python's urllib2 module and then putting it in a table. This data is basically just going to be in a table with one column and one row. How do I have it so that when I run the script it just updates the record? I don't want to make it a primary key because I'm probably going...
Hello all,
I'm executing sql queries in oracle 10g.
I want to join 3 tables into a single new table containing all the records from the 3 individual tables. The balance should be Summed up wherever the reg_id is duplicated between the 3 tables, such that there is just one entry per reg_id with the summed balance in my new table.
Sampl...
SELECT DISTINCT group_id
, supplier_id
, supplier_name
, site_division_id
, site_division_name
FROM view_supplier_site
WHERE supplier_id IN (SELECT DISTINCT supplier_id
FROM view_supplier
WHERE YEAR IN (2008, 2009)
AND received_quantity > 0...
I've been tasked to do generate some reports on our Request Tracker usage. Request Tracker is a ticketing system we use for several departments were I work. To do this I'm taking a nightly snapshot of details about tickets altered for the day into another database. This approach decouples my reporting from the the internal database schem...
I would like to execute a stored procedure from Powershell (v2) against a SQL Server 2008 database. Coming from using C# as my primary language, I'm doing it in that fashion. For example, when I need to run a sproc that doesn't return results, here is what I'm doing now:
$con = new-object System.Data.SqlClient.SqlConnection($connectionS...
hi to all
I have a problem for querying records into mysql
explanation below
The user could pick a date to assign in variable fromdate and todate
example.
$fromdate = 2008/01/01
$todate = 2009/10/31
In above case, i have to loop and query with the ff:
SELECT * FROM table where date BETWEEN '2008/01/01' AND '2008/12/31';
second...
Hi all,
Is it possible to pass a table (or table variable) as a parameter of a storedproc when executing the storedproc. If yes then how. I need an example.
Please help.
...
Nitpicker Question:
I like to have a function returning a boolean to check if a table has an entry or not. And i need to call this a lot, so some optimizing is needed.
Iues mysql for now, but should be fairly basic...
So should i use
select id from table where a=b limit 1;
or
select count(*) as cnt from table where a=b;
or some...
Is there a command/SQL query to lock a particular table in MS SQL Server to stop all related transactions using ODBC?
...
For example, a have varchar value "40.00" and want to use it with operators ">" or "<" in where clause. How can I use it?
...
Any ideas on building a Sql Server (2008) query that will give me say the "date specific prices for an item based on the default or override where exists".
So a Default table might look like this - columns Price, StartDate, EndDate (yyyy-M-d):
Default: $10, 2010-1-1, 2010-2-1
The Override table like this:
Override: $12, 2010-1-5, ...
I am trying to export the following data in the query from ms sql server to access, it says an error "Field wkid already exists in the table results"
when i try to execute the same using sql query analyser, its not giving any error.i am getting the results in the grid
Select a.wkid,a.stid,a.pfid,pf.pfname,a.modid,mm.md,a.catid,
[sp],re...
I have a varchar field in my database which i use for two significantly different things. In one scenario i use it for evaluating with case sensitivity to ensure no duplicates are inserted. To achieve this I've set the comparison to binary. However, I want to be able to search case-insensitively on the same column values. Is there any wa...