Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use SQL query #385

Open
fangyukui opened this issue Mar 21, 2016 · 5 comments
Open

Use SQL query #385

fangyukui opened this issue Mar 21, 2016 · 5 comments

Comments

@fangyukui
Copy link

Hi !
I have a SQL statement:

SELECT Organization_ID,Organization_Name,ParentId,'0' AS isUser FROM Base_Organization UNION ALL
SELECT U.User_ID AS Organization_ID ,U.User_Code+'|'+U.User_Name AS User_Name,S.Organization_ID,'1'
AS isUser FROM Base_UserInfo U RIGHT JOIN Base_StaffOrganize S ON U.User_ID = S.User_ID

Could you tell me how to write using Simple.Data ? thank you !!

@BenMagyar
Copy link

Unions are not supported in Simple.Data, so it would be best to split it into two queries and then concat once fetched.

@fangyukui
Copy link
Author

Thank you for your answers!
But we still have a problem.

select a,b,c,'0' as d from [table]

'0' as d how to write using Simple.Data?

@BenMagyar
Copy link

Aliasing a constant value is not supported either I believe, it must be a reference to a column.

@j-hudecek
Copy link

you can also use Simple.Data.RawSql https://github.com/jasondentler/Simple.Data.RawSql

@fangyukui
Copy link
Author

Thank!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants