[Lift] Re: How to specify the SELECT statement in the Mapper ?
MetaMapper.findAllFields may work for what you're doing, but with the DAYOFWEEK conversion you may just have to go directly against the DB. Derek On Sun, Nov 8, 2009 at 11:44 PM, Neil.Lv anim...@gmail.com wrote: Hi all, There is some example code: ### SELECT id, name, sex, created_at, DAYOFWEEK(created_at,) as week, (CURRENT_DATE) as t FROM users WHERE created_at (CURRENT_DATE ) AND created_at (CURRENT_DATE + interval 2 day) ORDER BY created_at ASC ### How can i specify the SELECT statement that i don't want all the columns and i want add the column as week in the example code ? Any help would be much appreciated! Cheers, Neil --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: How to specify the SELECT statement in the Mapper ?
Is there a some simple code ~? Thanks very much! Cheers, Neil On Nov 13, 10:50 pm, Derek Chen-Becker dchenbec...@gmail.com wrote: MetaMapper.findAllFields may work for what you're doing, but with the DAYOFWEEK conversion you may just have to go directly against the DB. Derek On Sun, Nov 8, 2009 at 11:44 PM, Neil.Lv anim...@gmail.com wrote: Hi all, There is some example code: ### SELECT id, name, sex, created_at, DAYOFWEEK(created_at,) as week, (CURRENT_DATE) as t FROM users WHERE created_at (CURRENT_DATE ) AND created_at (CURRENT_DATE + interval 2 day) ORDER BY created_at ASC ### How can i specify the SELECT statement that i don't want all the columns and i want add the column as week in the example code ? Any help would be much appreciated! Cheers, Neil --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: How to specify the SELECT statement in the Mapper ?
If you mean raw sql: DB.runQuery(SELECT * FROM abc) Cheers, Tim On 13 Nov 2009, at 17:35, Neil.Lv wrote: Is there a some simple code ~? Thanks very much! Cheers, Neil On Nov 13, 10:50 pm, Derek Chen-Becker dchenbec...@gmail.com wrote: MetaMapper.findAllFields may work for what you're doing, but with the DAYOFWEEK conversion you may just have to go directly against the DB. Derek On Sun, Nov 8, 2009 at 11:44 PM, Neil.Lv anim...@gmail.com wrote: Hi all, There is some example code: ### SELECT id, name, sex, created_at, DAYOFWEEK(created_at,) as week, (CURRENT_DATE) as t FROM users WHERE created_at (CURRENT_DATE ) AND created_at (CURRENT_DATE + interval 2 day) ORDER BY created_at ASC ### How can i specify the SELECT statement that i don't want all the columns and i want add the column as week in the example code ? Any help would be much appreciated! Cheers, Neil --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: How to specify the SELECT statement in the Mapper ?
Ok, Thanks for all your suggestion! I'll try it again, :) Cheers, Neil On Nov 14, 2:52 am, harryh har...@gmail.com wrote: You'll be better off if you don't do it that way. Compute the day of week from created_at in your scala code (personally I prefer joda time for this sort of thing), instead of having the database do it for you. Use the database to store and retrieve data, not to perform calculations. -harryh On Nov 9, 1:44 am, Neil.Lv anim...@gmail.com wrote: Hi all, There is some example code: ### SELECT id, name, sex, created_at, DAYOFWEEK(created_at,) as week, (CURRENT_DATE) as t FROM users WHERE created_at (CURRENT_DATE ) AND created_at (CURRENT_DATE + interval 2 day) ORDER BY created_at ASC ### How can i specify the SELECT statement that i don't want all the columns and i want add the column as week in the example code ? Any help would be much appreciated! Cheers, Neil --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---