Tag: mysql

column name for display in case

SELECT favorite_id,MO,name,image_id,case image_id when 0 then (select image_path as image_path from images where image_id in (select default_image from registration where reg_id=9)) else (select image_path as image_path from images where image_id=b.image_id and active=1) end FROM buddies b where reg_id=9 in this select: select image_path as image_path i need to name the column name but because the […]

How to create sequential ID's per user in Postgresql

I’m trying to create a table in postgresql to hold user Work Items. Each Work Item will have a unique ID across the system, but then will also have a friendly sequential ID for that specific user. So far I have been just using: CREATE TABLE WorkItems ( Id SERIAL NOT NULL PRIMARY KEY, … […]

Store connection string in database and retrieve it on application startup

I am developing an winforms application in VS 2010 to retrive data from Sql Server or MySql to Sql Server or MySql. My design is something like this. So here I am storing all values of connection string in Sql Server database table in separate column. I am able to get the required fields and […]

SQL query to join 2 tables

I want to join the following 2 tables in postgres: table1 ( i1 character varying , i2 character varying , i3 character varying ) table2 ( i4 character varying , startorend character varying , begin integer , end character integer ) table1 contains the following values: p1 p2 p3 p4 p10 p6 p7 p8 p9 […]

SQL – Select Boolean Results from Table

Well ,I didn’t find a correct title for this question, sorry about that. I Have one table where I store some emails sent to users. In this table I can know if the user read or not the email. Table structure: [MAILSEND_ID] (INT), [ID_USER] (INT), [MAIL_ID] (INT), [READ] (BIT) Data: ;WITH cte AS ( SELECT […]

Handling time in PHP/SQL

I’m doing a school project in which I have to put news in an SQL database and, when a certain time passes (around a week or so) automatically edit the database to notify that a specific piece of news is no more active. For example, I put on a news on monday, and I want […]

SQL Table Counting and Joining

I have Table A, Column 1. This table has values such as: 1 2 3 3 4 4 4 5 I have Table B, Column 2. Which lists certain values, like: 1 3 4 I need a query to Count each unique value in Table A, but ONLY if that value is present in Table […]

Plastic SCM MySQL Setup

After fresh installs of Plastic SCM and MySQL, I try to change the database backend to MySQL but consistently get the following error. The database rep_1 can’t be created. Check the server log (plastic.server.log). Error: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. at Codice.CM.Data.BaseDataManager.CreateSingleRepository(Int64 […]

Dividing count(*) sql statements to get ratios

I have a table with one column as a web site name and one column as an action that can be done for that website. So, one row will look like this – site action —– —— Yahoo View I am trying to find the ratio of one action to another. I know how I […]

Multiple database support with entity framework

I am new to entity framework. Sadly My first task involves using it to create an architecture that can connect to MsSql or Mysql database just by changing the connection string. Both database will have the same schema. Can anyone guide me or point to a resource that can help me with this? Thanks.

MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.