hi!
I have a table for players, a table for teams, and a table for team_players (using SQLServer 2005). Not all players are on a team. I would like to craft a query that will return one row for each non-team player, and one row for each team (i.e. there is one result row representing all 20 players on the Knicks, and that result row c...
I have a table which have an integer coloumn. Let table name is Table1 and ColName is Col1.
I want to add number 15 to every value in col1. what will be the sql query for this.
...
I have a database with a rather large number of tables, about 3500, and an application that needs to access a table list.
On a particular server this takes over 2.5 min to return.
EXEC sp_tables @table_type="'TABLE'"
I know there are faster ways to do that but sadly I'm not in a position to modify the application and need to find a...
Is there an easy way of dumping a SQLite database table into a text string with insert statements to be imported into the same table of a different database?
In my specific example, I have a table called log_entries with various columns. At the end of every day, I'd like to create a string which can then be dumped into an other database...
Hi
This fairly unusual, but because of office politics etc. we have (read-only) access to the data warehouse, but not to the live data. However we need up-to-date data to populate our relational (OLTP) database (MS SQL server. The data in the warehouse (also MS) is in star schema format (i.e. Dimensions and Facts). I am not very familia...
hello all,
I have a teradata table with about 10 million records in it, that stores a numeric id field as a varchar. i need to transfer the values in this field to a bigint column in another table, but i can't simply say cast(id_field as bigint) because i get an invalid character error. looking through the values, i find that there co...
I want to update a Column in a Table, based on the minimum of another column of the same table.
eg.
JobPositonId | JobPositonName | JobDescriptionId | ContactId
1 | 1 | 1 | 1
2 | 1 | 1 | 0
3 | 1 | 1 | 0
I want to updat...
I have a SQL script to run against a large database. I'd like to put a couple of simple queries at the start, just as a sanity check.
Is there any way to write an assertion in MySQL? Or any kind of "select ..., and if it doesn't match this value, then abort the entire script"?
...
I can easily get a random record with this:
SELECT * FROM MyTable ORDER BY NewId()
I can easily get a record with "today's date" with this:
SELECT * FROM MyTable WHERE MyDate = "2010-24-08" -- db doesn't store times
But how would I combind the two?
Get 1 random record... anything with today's date.
If none are found...
I tried to store Arabic string in SQL 2008 database but it converted to " question mark " why ? and what should I do ?
...
Hi,
I have an HTML table with contents, I would like to have an feature of Edit/Delete to that table. How do I do it with PHP?
...
INSERT INTO `tims`.`pending_profile`(`id`, `nickname`, `location`, `role`, `yog`, `interests`, `favMoment`, `gainThisYr`, `futurePlans`, `bio`)
VALUES ('1', '1', '1', '1', '', '1', '1', '1', '1', '1')
ON DUPLICATE KEY UPDATE ( nickname ='1', location= '1', role= '1',yog= '1',interests= '1',favMoment= '1',gainThisYr= '1',futurePlans= '1'...
i have 500 records in a table. one column holds all html data. so e.g -
html> body> ... /body> /html>.
What i want to do is a find and replace. i have this tag in every single record -
<table id="something something" />
i want to replace that in all the rows with <table id="" />
now the difficult part is all the "something something" is...
I have a field of type BIT in my MySQL table. I want to store statuses of the record using bit value, for example:
1 = status1
2 = status2
4 = status3
8 = status4
Each record can have many statuses at once. For status1 and status3 the value will be 1 + 4 = 5. I can query table for all records with status3 using:
SELECT *
FROM `tab...
I want to select from C_Table where Name='John' and use like operator
for example
select Name from C_Table where Name='John' AND where Details like %Boy%
How to do this? Please help me...
(Table name is C_Table)
-----------------------------------------------
Name | P_No | C_No | Details |
---------------------------...
I have a table CSFT_SuggestionItem with cols like:
SuggestionItemID Title Description, etc.
------------------------------------------------------------
1 Item 1 Do more work
2 Item 2 I think more is good
For each SuggestionItem, there can by multiple "Applic...
I have a table that contains a list of websites.
I have a sql variable @url, I want to select all the rows where the website is equal to @url. However, if there is no subdomain I want to match www and the root domain.
So, if @url='http://website.com' it should match both 'http://website.com' and 'http://www.website.com'
I'm currentl...
I have a SQL query:
SELECT b . * , CONCAT( GROUP_CONCAT( c.name ) ) categories, CONCAT( GROUP_CONCAT( c.id ) ) cids
FROM books b
JOIN categories_of_books cb ON b.id = cb.book_id
JOIN categories c ON c.id = cb.category_id
GROUP BY b.id
And it returns to me in categories alias all categories of books and in cids all categories ids.
A...
Heh guys,
I need help with a MySQL Query. The Output of the query should look like this
User1 User2
xxx1 xxx2
xxx3 xxx1
but not
User1 User2
xxx1 xxx2
xxx2 xxx1
and so on.
I need all "friendships" between different users. A friendship exists i.e. when
UserId 8 exists in Column User1_id
Us...
I need help with a SQL that will convert this table:
===================
| Id | FK | Status|
===================
| 1 | A | 100 |
| 2 | A | 101 |
| 3 | B | 100 |
| 4 | B | 101 |
| 5 | C | 100 |
| 6 | C | 101 |
| 7 | A | 102 |
| 8 | A | 102 |
| 9 | B | 102 |
| 10 | B | 102 |
===================
to ...