I have a table that is similar to the following below:
id | cat | one_above | top_level |
0 'printers' 'hardware' 'computers'
I want to be able to write a query, without using unions, that will return me a result set that transposes this table's columns into rows. What this mean...
Why is using a parameterized query to insert data into a table:
string queryString = "insert into product(id, name) values (@id, @name)";
faster than appending the values to the query string:
string queryString = "insert into product(id, name) values (" + _id + ", " + _name + ")";
?
When I use the command in a loop to insert 10K r...
Can something like this be done with a select statement:
SELECT col1, concat(col2 + ' ') FROM ....
GROUP BY col1
I know i can use count(col2) or sum(col2) for integers but is there a function for concatenating if the type is nvarchar or nchar?
...
Hello, I'm thinking about to store dates on user login in my site, but I don't know what is the most logical solution.
Initially, I though to use server timezone, and then to manage it using difference operations between server machine date and user machine date, but I've also considered to change it direclty using timezone and php clas...
Hello,
I have in my database a table Articles with Article Name and Article Tags. Article tags is a string column with tags in it like this: "people, life, president". Every article is tagged in this fashion.
Now i would like to get 10 most popular tags for whole population of articles. How to do this?
...
Positional parameters become a nightmare when dealing with more than 3 or 4 parameters. Named parameters are verbose. I'm thinking of doing this:
query("SELECT * FROM users WHERE username = ", $username, " AND password = ", $password)
With dynamic parameters (using func_get_args()), every second one being transformed into a positional...
In ms-access database i have a table named tableA
this table has a column called Call_Date which has 4 types of entries
dates ( e.g 10/23/2008 )
-
NA
Blanks ( empty cell )
how can i write a query to select all rows of tableA except those where the Call_Date column has - or NA or Blanks
i tried writing
Select * from tableA where C...
In ms-access database, is it possible to write an sql query to replace the number in a column with a number obtained by adding 2 to this original number. ie, all numbers in a column should be replaced by the original number plus 2
...
in the ms access database
columnA has date entries
collumnA
01/15/08
02/11/08
12/23/08
how do i write a query to add new column called months.
where months are calculated as
months = no. of months between original date to 01 dec 2009
...
Can I combine these two SQL queries into single query?
query1
ALTER TABLE tableA
ADD datam INTEGER;
query2
UPDATE tableA SET datam = DateDiff("m",[call_date],#12/1/2009#);
...
in ms-access, how to write a query / DDL to change multiple column names with a single query.
...
I'm returning results from the following query which is taking too long when running. I'm not sure how to eliminate the where parameters when they are not used in SSRS. All the @variables are strings
select S.SBSB_ID, LTRIM(RTRIM(M.MEME_FIRST_NAME)) + ' ' +
LTRIM(RTRIM(M.MEME_LAST_NAME)) AS Names,
(CASE M.MEME_REL WHEN 'M' THEN 'Subscr...
I have an Article with a Set of Category.
How can I query, using the criteria interface, for all Articles that contain all Categories with a certain Id?
This is not an "in", I need exclusively those who have all necessary categories - and others. Partial matches should not come in there.
Currently my code is failing with this desperate...
I have a simple SQL query,
SELECT * FROM phones WHERE manu='$manuf' AND price BETWEEN $min AND $max
The issue is that all of the variable fields are connected to fields that will sometimes be empty, and thus I need a way to make them match any value that their respective field could take if they are empty. I tried
$min=$_REQUEST['min...
In Access 2003, I'm trying to take a table and if any Indicator = 1 for ANY line of a given ID, make all lines = 1 for that ID
For Example, if we have:
ID Indicator
Jack 0
Jack 0
Jeff 1
Jeff 0
Mark 1
Mark 1
Would become:
ID Indicator
Jack 0
Jack 0
Jeff 1
Jeff 1
Mark 1
Mark 1
Since both Jeff and Mark have at least 1 line with...
Example:
> db.stuff.save({"foo":"bar"});
> db.stuff.find({"foo":"bar"}).count();
1
> db.stuff.find({"foo":"BAR"}).count();
0
...
Whats the best way to access/query a DB Ref:
UPDATE:
users: name, groupref : {$ref:"groups",$id:"ObjectId ..." } }
groups: name, topic, country,...,..
Assumption is that user belongs to only one group, how would I get all users for a group whose country starts with the letter 'A'? Country is a string.
Also, how would it change if use...
In an MS-Access database with Table called NewTable3
can i combine these 3 sql queries into one query
UPDATE NewTable3 SET SAO = '0' WHERE SAO LIKE '-';
UPDATE NewTable3 SET SAO = '0' WHERE SAO LIKE 'NULL';
UPDATE NewTable3 SET SAO = '0' WHERE SAO LIKE 'NA';
...
i am a little confused in finding out what would be the best way to replace all occurances of
1. Blanks
2. -
3. NA
from all collumns of TableA with question mark ? charachter.
Sample Row in orignal tableA
444586 RAUR <blank> 8 570 NA - 13 - SCHS299 MP 339 70 EN <blank>
Same Row in Expected TableA
444586 RAUR ? 8 570 ? ? 13 ? SCH...
I have faced a very strange situation here.
I am accessing database (MDB) through JET. I use DBGrid and DBNavigator to allow user access it. Dataset is created using TADOQuery component, with the following query:
SELECT *, (DateDiff ('y',[Birth Date], Now())) AS [Age] FROM TableName
It works fine. But whenever I press Refresh button ...